Controling Datasources

Discussion in 'ASP .Net Datagrid Control' started by barryfz, Jun 22, 2006.

  1. barryfz

    barryfz Guest

    I am working with the new datasource component which I guess is a
    replacement for the dataadapter/dataset cmoponents. I guess it is cool that
    I can hook these up without writing any code behind now (does anybody in
    asp.net use the vs studio gui for anything but a notepad substititue, all i
    see in post after post is a lot of asp code, i thought the idea of vs.net
    was to eliminate the need for coding this stuff, but that is another rant).
    Anyway I get data and I bind it to different things, I can hook parameters
    to various things. All very cool. But how do I control these things. They
    always load data. I don't necessarily want them to load data all the time.
    I may have user controls or panels that are not visible/enabled at times and
    I don't need the data loaded for them. There doesn't seems to ben an
    enable/disable structure.

    How do I stop them from loading when I don't need the data? Am I supposed
    to code many look alike pages now that only have datasources that all need
    to be loaded? I seem to be missing something here.

    --
    Barry
    barryfz, Jun 22, 2006
    #1
    1. Advertising

  2. Hi Barry,

    Thank you for your post.

    Based on my research, use SqlDataSource for example, will not load data if
    the binding control is hidden. You can verify this by following test:

    1) Create a webform, add a SqlDataSource and a GridView, bind the GridView
    to the SqlDataSource
    2) Create an event handler for SqlDataSource's Selecting event, this event
    is triggered before the DataSource control is about to call the Select
    method to retrieve data;
    3) If you set GridView.Visible = false, you will notice that the Selecting
    event of SqlDataSource doesn't gets fired.

    This behavior can prove that the SqlDataSource's data loading is controlled
    by the binding control, since a control doesn't get rendered when it's
    hidden, so the data doesn't need to load.

    As for the Enable property, because the data still needs to rendered, so
    the DataSource will still need to load the data.

    Hope this helps. Please feel free to post here if anything is unclear.

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Jun 23, 2006
    #2
    1. Advertising

  3. barryfz

    barryfz Guest

    Thanks, that seems to work.
    Barry
    barryfz, Jun 23, 2006
    #3
  4. Hi Barry,

    Thank you for your update.

    If you have any other questions or concerns, please do not hesitate to
    contact us. It is always our pleasure to be of assistance.

    Have a nice day!

    Regards,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Jun 24, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TeraNews
    Replies:
    0
    Views:
    2,476
    TeraNews
    Jan 9, 2004
  2. McGiv
    Replies:
    0
    Views:
    405
    McGiv
    Apr 30, 2004
  3. Kikoz

    Controling cache expiration

    Kikoz, Mar 28, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    738
    =?Utf-8?B?S2lrb3o=?=
    Mar 28, 2005
  4. =?Utf-8?B?TWFydHlOWg==?=

    Controling panel visibility

    =?Utf-8?B?TWFydHlOWg==?=, May 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    394
    =?Utf-8?B?TWFydHlOWg==?=
    May 26, 2005
  5. Bredahl jensen

    Controling table layout dynamically.

    Bredahl jensen, Jun 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    317
    Bruce Barker
    Jun 10, 2005
Loading...

Share This Page