ASP.NET AJAX

Discussion in 'ASP .Net' started by Ganesha, May 14, 2008.

  1. Ganesha

    Ganesha Guest

    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
     
    Ganesha, May 14, 2008
    #1
    1. Advertising

  2. Ganesha

    bruce barker Guest

    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)


    "Ganesha" wrote:

    > 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
    >
    >
     
    bruce barker, May 14, 2008
    #2
    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. =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=

    Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta

    =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?=, Feb 20, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    606
    Patrick
    Feb 21, 2007
  2. minnie
    Replies:
    1
    Views:
    711
    Andrew Thompson
    Dec 13, 2006
  3. mark4asp
    Replies:
    1
    Views:
    1,157
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Mar 24, 2007
  4. Tony K
    Replies:
    2
    Views:
    1,049
    Tony K
    May 4, 2007
  5. Nathan Sokalski
    Replies:
    2
    Views:
    484
    Nathan Sokalski
    Jun 2, 2007
Loading...

Share This Page