ajax.net

Call .NET method asynchronously and bind to grid upon completion

与世无争的帅哥 提交于 2019-12-06 07:56:07
Container.RetrieveItems() calls a service which takes a while so I would like to call it asynchronously (after the items are retrieved they are set to the List property of the Container class). Upon completion of retrieving the items, I would like it to update a gridView which is inside an updatePanel (updatePanel Mode="Conditional" and ScriptManager EnablePartialRendering="true". UpdatePanel has no trigger items). I have set breakpoints and stepped through each step. The items are retrieved, grid is databound then it calls update. No exceptions are being thrown but the grid is not updating

JQuery AJAX post to asp.net webmethod never getting called

孤街醉人 提交于 2019-12-06 06:48:31
问题 I have a web method in one of my aspx pages: [WebMethod] public static string AddDebt(int userId, int type, string description, float amount) And in the aspx page I have the JQuery $(".addDebt").click(function (e) { e.preventDefault(); var userId = $("[id$='txtUserId']").val(); var type = $("[id$='ddlExistingDebtType']").val(); var description = $("[id$='txtExistingDebtLender']").val(); var amount = $("[id$='txtExistingDebtAmount']").val(); var results = new Array(); results.push({ userId:

$get() and $find() with AJAX.NET

♀尐吖头ヾ 提交于 2019-12-05 19:48:13
I'm trying to follow the PageMethods example found here . However, I get an error when trying to call $get('Label1') . Since, Label1 is an asp:Label, it works if I call $get() with the ClientID. Yet, the example is using the actual ID. Is there a way to use $get() with the actual ID? Well that depends what the label is contained in. In some controls it will be Label1 and work, in others it won't be. Don't chance it. So on a simple page it gets rendered as Label1: <form id="form1" runat="server"> <div> <asp:Label ID="Label1" Text="test" runat="server"></asp:Label> </div> </form> On a more

JQuery AJAX post to asp.net webmethod never getting called

匆匆过客 提交于 2019-12-04 13:50:13
I have a web method in one of my aspx pages: [WebMethod] public static string AddDebt(int userId, int type, string description, float amount) And in the aspx page I have the JQuery $(".addDebt").click(function (e) { e.preventDefault(); var userId = $("[id$='txtUserId']").val(); var type = $("[id$='ddlExistingDebtType']").val(); var description = $("[id$='txtExistingDebtLender']").val(); var amount = $("[id$='txtExistingDebtAmount']").val(); var results = new Array(); results.push({ userId: userId }); results.push({ type: type }); results.push({ description: description }); results.push({

Invoke ASP.NET TextChanged event from JavaScript using __doPostBack

橙三吉。 提交于 2019-12-04 05:32:49
问题 Like many others, I'm trying to invoke a .NET control's server-side event from JavaScript. Specifically, I want to fire the TextChanged event on a TextBox named txtSearch . Therefore, I'm looking to reach the following event from client-side: protected void txtSearch_TextChanged(object sender, EventArgs e) Having read many answers on SO (for example here and here) I have the following JavaScript: __doPostBack('ctl00$ctl00$Container$Main$txtSearch', 'TextChanged'); But the server-side event

Invoke ASP.NET TextChanged event from JavaScript using __doPostBack

馋奶兔 提交于 2019-12-02 03:53:32
Like many others, I'm trying to invoke a .NET control's server-side event from JavaScript. Specifically, I want to fire the TextChanged event on a TextBox named txtSearch . Therefore, I'm looking to reach the following event from client-side: protected void txtSearch_TextChanged(object sender, EventArgs e) Having read many answers on SO (for example here and here ) I have the following JavaScript: __doPostBack('ctl00$ctl00$Container$Main$txtSearch', 'TextChanged'); But the server-side event never fires. I've tried numerous permutations: with the AutoPostBack true and false, with and without

How to trigger an UpdatePanel by a TextBox control?

会有一股神秘感。 提交于 2019-12-01 17:08:37
Consider the following code: <label>Search:</label><asp:TextBox runat="server" ID="search" ClientIDMode="Static" OnKeyUp="$('#searchButton').click();" /><asp:Button runat="server" ID="searchButton" ClientIDMode="Static" /> <asp:UpdatePanel runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView runat="server" DataSourceID="EntityDataSource1" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="true" PageSize="20" Width="400" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="searchButton" /> </Triggers> </asp:UpdatePanel> The button will trigger an

How to trigger an UpdatePanel by a TextBox control?

怎甘沉沦 提交于 2019-12-01 16:46:42
问题 Consider the following code: <label>Search:</label><asp:TextBox runat="server" ID="search" ClientIDMode="Static" OnKeyUp="$('#searchButton').click();" /><asp:Button runat="server" ID="searchButton" ClientIDMode="Static" /> <asp:UpdatePanel runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView runat="server" DataSourceID="EntityDataSource1" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="true" PageSize="20" Width="400" /> </ContentTemplate> <Triggers> <asp

How to: Back button support “Ajax”

落爺英雄遲暮 提交于 2019-11-30 10:28:01
I have an asp.net ajax website, it full of things happen on the same page without page reload, such as sorting records, paging,... When the user go to another page in the same site and press the browser back button, how can i make the browser save the page state to return to it with the preselected options such as sorting option, page number in the paging. I knew that there is a history control in the new .net 3.5 but its working in the same page not while navigating from a page to another. Also i am looking for a solution which work in all browsers. Thanks, You dont need 3.5 for the history

How to: Back button support “Ajax”

左心房为你撑大大i 提交于 2019-11-29 15:35:36
问题 I have an asp.net ajax website, it full of things happen on the same page without page reload, such as sorting records, paging,... When the user go to another page in the same site and press the browser back button, how can i make the browser save the page state to return to it with the preselected options such as sorting option, page number in the paging. I knew that there is a history control in the new .net 3.5 but its working in the same page not while navigating from a page to another.