Quantcast
Channel: DataSource Controls - SqlDataSource, ObjectDataSource, etc.
Viewing all articles
Browse latest Browse all 956

using selectcommand on code behind with gridview

$
0
0

I have a sqldatascource that I need to pass null values to it and then use the selectcommand specified by a stored procedure and then using the result query to populate a gridview on the page load

notes: I tried the stored procedure on sql server managment studio and its working fine

          I alread specified sqldatascource on for gridview1 in the page design view

I tried this code but the gridview still shows empty

protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataSource1.SelectParameters["location"].DefaultValue = null;
        SqlDataSource1.SelectParameters["time"].DefaultValue = null;
        SqlDataSource1.SelectParameters["date"].DefaultValue = null;
        SqlDataSource1.DataBind();
        GridView1.DataBind();
    }




Viewing all articles
Browse latest Browse all 956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>