How to only refresh portion of a .aspx web page?

Discussion in 'ASP .Net' started by Guest, Sep 27, 2005.

  1. Guest

    Guest Guest

    Hi, friends,

    I have a big problem: Based on a user's selection, portion of a web page
    need to be refreshed. For instance, if a user select Math, all avaible Math
    classes will be populated in the list. However, the rest of this web page
    does NOT need to change.

    Since all info in this page are queried from DB, I was asked to limit my
    queries if possible for better performance. For example, do not query DB
    again for the info that do not need repopulated, only refresh the portion of
    a web page that need to be repopulated. Even, idealy, do not send the whole
    page back to server, send back only the portion that need to be repopulated.

    Can we do this? How, and what is the best approach? Any reference papers or
    sample source code? (someone talked about <frame>, will it work, how?)

    Thanks a lot for your help.
    Guest, Sep 27, 2005
    1. Advertisements

  2. Yes, an embedded floating <iframe> will hold an internal page on its self (a
    whole aspx page). But I don't like this solution, it will have more problems
    yet (most notably, communication between the iframe and its parent). I
    suggest you enable View State for controls to persist their values, and just
    update the data you need upon post back...
    Wessam Bahnassi, Sep 27, 2005
    1. Advertisements

  3. Dealing with an iframe is much like dealing with two individual webpages...
    Wessam Bahnassi, Sep 27, 2005
  4. Guest

    Darren Kopp Guest

    Say you have 2 DropDownLists, when you enter the page, you would execute
    something like the following-

    private void Page_Load(...)
    if (!IsPostBack)
    DDL1.DataSource = datasource;

    Then you would set DDL1's auto postback property to true, and then write the
    code for what postback, something like

    private void DDL1_SelectedIndexChanged(...)
    DDL2.DataSource = data

    You can do this with as many drop down lists as you have, and each one keeps
    state through the viewstate. You could also use frame i'm sure, but I don't
    know what the code would be. You could aslo use an AJAX method, but I think
    the simpleist way to go about that is to just have a post back on selected
    index changed.

    Hope that helps,
    Darren Kopp
    Darren Kopp, Sep 27, 2005
  5. Hmmm. I don't know. My website isn't that old (about 3 months old). But I
    can't get any hit from google pointing to actual thread data.
    Do you have to do something special with the MSSQL database (something to
    enable searching... I don't know)...
    Wessam Bahnassi, Sep 27, 2005
  6. Guest

    Lucas Tam Guest

    ASP.NET 2.0 - Client Side callbacks.

    v1.x take a look at Javascript Remoting or Dart's Live Controls.
    Lucas Tam, Sep 27, 2005
  7. Guest

    Mr Newbie Guest

    It is also possible to use a Literal control

    You can pump HTML directly into this, perhaps this could form part of your
    solution ?
    Mr Newbie, Sep 27, 2005
  8. Steve C. Orr [MVP, MCSD], Sep 28, 2005
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.