How do I add Ajax to my ASPnet page so that a dump change can immediately affect the db backend
I have multiple dropdowns in a normal ASP.Net page.
I would like the user to be able to change them and have the Pseudo-post page back to the server and save those changes without having to hit the save button.
I don't really need to display anything extra, as the dropdown itself will reflect the new value, but I would like to post this change back without the whole page flash due to postback
I heard that this is possible with AJAX.Net ...
Can anyone point me in the right direction?
0
source to share
2 answers
Add a link to System.Web.Extensions and System.Web.Extensions.Design to your site. Then put the scriptman in your page and wrap your ddl in an updated panel. Do whatever you want in the background. For example...
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="yourDDL_SelectedIndexChanged">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
protected void yourDDL_SelectedIndexChanged(object sender, EventArgs e)
{
// do whatever you want
}
+2
source to share