Click here to Skip to main content
11,920,394 members (57,039 online)
Rate this:
Please Sign up or sign in to vote.
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.

Posted 11-Nov-11 6:53am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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;
   myControl.DataSource = myDataSource2;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.


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

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
2 Dave Kreskowiak 155
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,805
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web01 | 2.8.151120.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100