Hello Dean Thanks for your help, I tried your idea to make one working and then used the same for all of them now it is working, cheers many thanks >From: "Dean Fiala" < dfiala%40gmail.com">dfialagmail.com> >Reply-To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com >To: AspNetAnyQuestionIsOk%40yahoogroups.com">AspNetAnyQuestionIsOkyahoogroups.com >Subject: Re: [AspNetAnyQuestionIsOk] multiple sqldatasources and one >gridview >Date: Tue, 5 Jun 2007 10:36:10 -0400 > >Three suggestions.... > >1) create a simple page with one datasource and get that working > >2) replace your switch statement with this > >GridView1.Enabled = true; >GridView1.DataSourceID = String.Format("SqlDataSourceOP", GotoCase); >GridView1.DataBind(); >GridView1.Visible = true; > >can't tell what your page looks like, but you also might want to try >this... > >SQLDataSourceControl = Page.FindControl( >String.Format("SqlDataSourceOP", >GotoCase)); >GridView1.Enabled = true; >GridView1.DataSourceID =SQLDataSourceControl.ID; >GridView1.DataBind(); >GridView1.Visible = true; > > >On 6/5/07, Creative Designer < owaiz_vaiyani%40hotmail.com">owaiz_vaiyanihotmail.com> wrote: > > > > > > > > the sqldatasource controls are working fine > > > > i am pasting codebehind page code below > > > > using System; > > using System.Data; > > using System.Configuration; > > using System.Collections; > > using System.Web; > > using System.Web.Security; > > using System.Web.UI; > > using System.Web.UI.WebControls; > > using System.Web.UI.WebControls.WebParts; > > using System.Web.UI.HtmlControls; > > > > public partial class SysAdmin_SearchCustomer : System.Web.UI.Page > > { > > protected void Page_Load(object sender, EventArgs e) > > { > > > > } > > > > protected void Button1_Click(object sender, EventArgs e) > > { > > String Op1 = SearchOp1.Text; > > String Op2 = SearchOp2.Text; > > String Op3 = SearchOp3.Text; > > String Op4 = SearchOp4.Text; > > int GotoCase = 0; > > if (Op1.Equals("") && Op2.Equals("") && Op3.Equals("") && > > Op4.Equals("")) > > { > > Response.Write("Please Enter Something To Search"); > > } > > else > > { > > if (Op1.Length > 0 && Op2.Length > 0 && Op3.Length > 0 && > > Op4.Length > 0) > > { > > GotoCase = 1; > > > > } > > else if (Op1.Length > 0 && Op2.Length > 0 && Op3.Length > 0 && > > Op4.Length == 0) > > { > > GotoCase = 2; > > > > } > > else if (Op1.Length > 0 && Op2.Length > 0 && Op3.Length == 0 && > > Op4.Length == 0) > > { > > GotoCase = 3; > > } > > else if (Op1.Length > 0 && Op2.Length == 0 && Op3.Length == 0 && > > Op4.Length == 0) > > { > > GotoCase = 4; > > } > > else if (Op1.Length == 0 && Op2.Length > 0 && Op3.Length > 0 && > > Op4.Length > 0) > > { > > GotoCase = 5; > > } > > else if (Op1.Length == 0 && Op2.Length > 0 && Op3.Length > 0 && > > Op4.Length == 0) > > { > > GotoCase = 6; > > > > } > > else if (Op1.Length == 0 && Op2.Length > 0 && Op3.Length == 0 && > > Op4.Length == 0) > > { > > GotoCase = 7; > > } > > else if (Op1.Length == 0 && Op2.Length == 0 && Op3.Length > 0 && > > Op4.Length > 0)