Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SqlDataSource

Author  Topic 

krasnokojiy
Starting Member

18 Posts

Posted - 2008-02-24 : 10:53:15
Dear Friends in my project , i' ve used two SqlDataSource, one button and one gridview control;

the process that i want to do is when i click the button control ,according the if structure in this button control ; one of the SqlDataSource control assign to the gridview control DataSource property (but i assign the DataSourceID property for the gridview , it runs);

but i couldnt do it, what can i do for it? (my code doesnt give any errors but doesnt do anything too)

my code is here;

protected void btnSearch_Click(object sender, EventArgs e)
{
if (txtSearch.Text != null){
SqlDataSource3.SelectParameter["key"].DefaultValue = txtsearch.Text;
Gridview1.DataSource = SqlDataSource3;
GridView1.DataBind();
}
else
{
SqlDataSource1.SelectParameters["keySession"].DefaultValue = cbSession.SelectedItem.ToString();
SqlDataSource1.SelectParameters["keyClass"].DefaultValue = cbClass.SelectedItem.ToString();
SqlDataSource1.SelectParameters["keyUnit"].DefaultValue = cbUnit.SelectedItem.ToString();
Gridview1.DataSource = SqlDataSource1;
GridView1.DataBind();
}
}

MC

krasnokojiy
Starting Member

18 Posts

Posted - 2008-02-24 : 12:29:50
thanks a lot , i've found the solution
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-02-24 : 12:33:47
What was the issue...so if someone else encounters this they may learn as well..?



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page
   

- Advertisement -