Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good day to you all.

I am hoping someone could give a suggestion to a problem I am having on a ASP.NET page.

I have 2 SQLDataSource object on the page and both have their parameters set via the Wizard; however, I would like to run only one or the other dependent upon a value in a Session object.

Sadly, both SQL objects run which degrades page rendering, especially when moving to a next page in a data grid.

Is there any way that I could prevent one or the other object from performing it's operation in the page load event.

Any hints, tricks will be greatly appreciated.

F
Posted

Harsh but true Mark. Thank you very much for your time. I realized that for this particular installation I have to let the Wizard go. Again, thanks for getting into my head.

F
 
Share this answer
 
There is no trick to it. You are in complete control of your code. You just need to step away from the Wizard and learn to do it yourself.

if(Session["Foo"] == "some value")
{
   myControl.DataSource = myDataSource1;
}
else
{
   myControl.DataSource = myDataSource2;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900