Ajax not working - still doing post-backs

Discussion in 'ASP .Net' started by JFord, Dec 13, 2008.

  1. JFord

    JFord Guest

    Hi,

    I'm new to AJAX and I've been going crazy trying to figure out what's
    stopping my controls from updating on the client side rather than just
    normally sending a post-back.

    I have a script manager, and an UpdatePanel which contains a small form and
    a gridview.
    Upon submitting the form, the Gridview should be updated. But it keeps on
    doing it on the server side.

    Here's an edited part of my code:
    =================================================================================
    <form id="form1" runat="server">
    <asp:ScriptManager
    ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel
    ID="UpdatePanel1" runat="server">
    <ContentTemplate>

    <asp:TextBox
    ID="TextBoxValue" runat="server"></asp:TextBox>

    <asp:Button
    ID="Search" runat="server" CausesValidation="False" Height="22px"

    onclick="Search_Click" Text="חפש" UseSubmitBehavior="False" Width="48px" />

    <asp:RadioButtonList
    ID="RadioButtonListDic" runat="server"

    RepeatDirection="Horizontal">
    <asp:ListItem
    Selected="True" Text="1234">1234</asp:ListItem>
    <asp:ListItem
    Text="1234">1234</asp:ListItem>
    </asp:RadioButtonList>

    <asp:GridView ID="GridViewResults" runat="server"
    CellPadding="4" ForeColor="#333333"
    GridLines="None"
    AutoGenerateColumns="False">

    </asp:GridView>
    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Search"
    EventName="Click" />
    </Triggers>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server"
    AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate>
    Searching
    </ProgressTemplate>
    </asp:UpdateProgress>
    </form>
    =================================================================

    As you can see, I've even tried to specificly make the Search button update.
    Also I should mention that I'm using a Masterpage, with no ajax controls.

    What am I doing wrong?

    Many thanks,
    JFord
    JFord, Dec 13, 2008
    #1
    1. Advertising

  2. With ajax, your page also sends postbacks. You benefit in less html being
    sent to the client, otherwise there will be the same server-side processing.


    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin


    "JFord" <> wrote in message
    news:...
    > Hi,
    >
    > I'm new to AJAX and I've been going crazy trying to figure out what's
    > stopping my controls from updating on the client side rather than just
    > normally sending a post-back.
    >
    > I have a script manager, and an UpdatePanel which contains a small form
    > and
    > a gridview.
    > Upon submitting the form, the Gridview should be updated. But it keeps on
    > doing it on the server side.
    >
    > Here's an edited part of my code:
    > =================================================================================
    > <form id="form1" runat="server">
    > <asp:ScriptManager
    > ID="ScriptManager1" runat="server" />
    > <asp:UpdatePanel
    > ID="UpdatePanel1" runat="server">
    > <ContentTemplate>
    >
    > <asp:TextBox
    > ID="TextBoxValue" runat="server"></asp:TextBox>
    >
    > <asp:Button
    > ID="Search" runat="server" CausesValidation="False" Height="22px"
    >
    > onclick="Search_Click" Text="חפש" UseSubmitBehavior="False" Width="48px"
    > />
    >
    > <asp:RadioButtonList
    > ID="RadioButtonListDic" runat="server"
    >
    > RepeatDirection="Horizontal">
    > <asp:ListItem
    > Selected="True" Text="1234">1234</asp:ListItem>
    > <asp:ListItem
    > Text="1234">1234</asp:ListItem>
    >
    > </asp:RadioButtonList>
    >
    > <asp:GridView ID="GridViewResults"
    > runat="server"
    > CellPadding="4" ForeColor="#333333"
    > GridLines="None"
    > AutoGenerateColumns="False">
    >
    > </asp:GridView>
    > </ContentTemplate>
    > <Triggers>
    > <asp:AsyncPostBackTrigger ControlID="Search"
    > EventName="Click" />
    > </Triggers>
    > </asp:UpdatePanel>
    > <asp:UpdateProgress ID="UpdateProgress1" runat="server"
    > AssociatedUpdatePanelID="UpdatePanel1">
    > <ProgressTemplate>
    > Searching
    > </ProgressTemplate>
    > </asp:UpdateProgress>
    > </form>
    > =================================================================
    >
    > As you can see, I've even tried to specificly make the Search button
    > update.
    > Also I should mention that I'm using a Masterpage, with no ajax controls.
    >
    > What am I doing wrong?
    >
    > Many thanks,
    > JFord
    Eliyahu Goldin, Dec 14, 2008
    #2
    1. Advertising

  3. JFord

    JFord Guest

    OK, then my terminology was incorrect.

    What I ment by "still doing post-backs", is that the page keeps refreshing
    like any other page with a form, instead of dynamicly updating the table.
    Like the UpdatePanel and ScriptManager were not there.

    "Eliyahu Goldin" wrote:

    > With ajax, your page also sends postbacks. You benefit in less html being
    > sent to the client, otherwise there will be the same server-side processing.
    >
    >
    > --
    > Eliyahu Goldin,
    > Software Developer
    > Microsoft MVP [ASP.NET]
    > http://msmvps.com/blogs/egoldin
    >
    >
    > "JFord" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I'm new to AJAX and I've been going crazy trying to figure out what's
    > > stopping my controls from updating on the client side rather than just
    > > normally sending a post-back.
    > >
    > > I have a script manager, and an UpdatePanel which contains a small form
    > > and
    > > a gridview.
    > > Upon submitting the form, the Gridview should be updated. But it keeps on
    > > doing it on the server side.
    > >
    > > Here's an edited part of my code:
    > > =================================================================================
    > > <form id="form1" runat="server">
    > > <asp:ScriptManager
    > > ID="ScriptManager1" runat="server" />
    > > <asp:UpdatePanel
    > > ID="UpdatePanel1" runat="server">
    > > <ContentTemplate>
    > >
    > > <asp:TextBox
    > > ID="TextBoxValue" runat="server"></asp:TextBox>
    > >
    > > <asp:Button
    > > ID="Search" runat="server" CausesValidation="False" Height="22px"
    > >
    > > onclick="Search_Click" Text="חפש" UseSubmitBehavior="False" Width="48px"
    > > />
    > >
    > > <asp:RadioButtonList
    > > ID="RadioButtonListDic" runat="server"
    > >
    > > RepeatDirection="Horizontal">
    > > <asp:ListItem
    > > Selected="True" Text="1234">1234</asp:ListItem>
    > > <asp:ListItem
    > > Text="1234">1234</asp:ListItem>
    > >
    > > </asp:RadioButtonList>
    > >
    > > <asp:GridView ID="GridViewResults"
    > > runat="server"
    > > CellPadding="4" ForeColor="#333333"
    > > GridLines="None"
    > > AutoGenerateColumns="False">
    > >
    > > </asp:GridView>
    > > </ContentTemplate>
    > > <Triggers>
    > > <asp:AsyncPostBackTrigger ControlID="Search"
    > > EventName="Click" />
    > > </Triggers>
    > > </asp:UpdatePanel>
    > > <asp:UpdateProgress ID="UpdateProgress1" runat="server"
    > > AssociatedUpdatePanelID="UpdatePanel1">
    > > <ProgressTemplate>
    > > Searching
    > > </ProgressTemplate>
    > > </asp:UpdateProgress>
    > > </form>
    > > =================================================================
    > >
    > > As you can see, I've even tried to specificly make the Search button
    > > update.
    > > Also I should mention that I'm using a Masterpage, with no ajax controls.
    > >
    > > What am I doing wrong?
    > >
    > > Many thanks,
    > > JFord

    >
    >
    JFord, Dec 14, 2008
    #3
    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. Mark S.

    Post Backs

    Mark S., Aug 13, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    774
    George Ter-Saakov
    Aug 13, 2003
  2. ALPO

    Stopping post backs possible??

    ALPO, Nov 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    316
    Joao S Cardoso [MVP]
    Nov 21, 2003
  3. Jason
    Replies:
    5
    Views:
    366
    darrel
    Dec 10, 2004
  4. Rosanne
    Replies:
    0
    Views:
    469
    Rosanne
    Jun 17, 2005
  5. Dirc Khan-Evans
    Replies:
    6
    Views:
    584
    Rosanne
    Oct 20, 2005
Loading...

Share This Page