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 OriginalGriff 7,740
1 DamithSL 5,769
2 Sergey Alexandrovich Kryukov 5,424
3 Maciej Los 5,076
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2014
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