ASP.NET AJAX

G

Ganesha

Hi,
I am new to AJAX and was trying to do the following. I want to update one
dropdownlist based on the selection in the other dropdownlist. I want it to
postback partially.
My code looks as follows:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataTextField="fieldname" DataValueField="fieldname" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>

<asp:DropDownList ID="DropDownList2" runat="server"
DataTextField="Text" DataValueField="Val">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>

When i click on Dropdownlist1 it posts back and works fine but the
IsInAsyncPostBack property of script manager will be set to false. As per my
knowledge it should be set to true for partial postback. Can anyone please
let me know why this propery is set to false. what am i doing wrong.

Thanks
 
B

bruce barker

while the update panel can be used for this its a bad choice. why is it bad?
your code is rerendering all the content in the panel on every click of the
dropdown, including the control with focus. try hitting the up/down arrows
while the focus is on DropDownList1. also if you site runs on the internet,
there can be a couple second delay before the response.

the correct way to code this is to use client code attached to the dropdown.
when the index changes, disable the second dropdown, give some loading feed
back to the user, start an async web service call to get the new values. on
request complete, load the second drop down and enable. be sure to handle
case when a second request happens before the first completes.


-- bruce (sqlwork.com)
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top