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

G

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.
 
W

Wessam Bahnassi

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...
 
W

Wessam Bahnassi

Dealing with an iframe is much like dealing with two individual webpages...
 
D

Darren Kopp

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;
DDL1.DataBind();
}
}

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
DDL2.DataBind();
}

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
 
W

Wessam Bahnassi

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)...
 
L

Lucas Tam

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.


ASP.NET 2.0 - Client Side callbacks.

v1.x take a look at Javascript Remoting or Dart's Live Controls.
 
M

Mr Newbie

It is also possible to use a Literal control

You can pump HTML directly into this, perhaps this could form part of your
solution ?
 
S

Steve C. Orr [MVP, MCSD]

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top