Click here to Skip to main content
Rate this: bad
good
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.

F
Posted 11-Nov-11 6:53am
ffowler665
Rate this: bad
good
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;
}
else
{
   myControl.DataSource = myDataSource2;
}
  Permalink  
Rate this: bad
good
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.

F
  Permalink  

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

  Print Answers RSS
0 Maciej Los 184
1 Sascha Lefévre 120
2 Abhinav S 104
3 Sergey Alexandrovich Kryukov 94
4 Richard MacCutchan 90
0 Sergey Alexandrovich Kryukov 6,628
1 OriginalGriff 6,298
2 Peter Leow 2,534
3 Maciej Los 2,492
4 Abhinav S 2,378


Advertise | Privacy | Mobile
Web04 | 2.8.150414.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