Ajax not working - still doing post-backs


J

JFord

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
 
Ad

Advertisements

E

Eliyahu Goldin

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

Advertisements

J

JFord

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 said:
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 said:
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
 

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

Top