postback

JSON post data to mvc controller

断了今生、忘了曾经 提交于 2020-01-06 20:06:16
问题 I got an entity class that contains a Person and Address. public class Person { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public List<Address> Addresses { get; set; } } public class Address { public string ZipCode { get; set; } public string City { get; set; } public string State { get; set; } public string Country { get; set; } } In my view i display a few checkboxes. @model DataContext.Models.Persons @{ ViewBag.Title = "Person

InvalidOperationException: PostBack Trigger Cannot Find a Control within the ItemTemplate of a DataList

不问归期 提交于 2020-01-06 16:55:15
问题 I would like to trigger a PostBack when the asp:LinkButton "addToCartButton" is clicked (see code below). I have declared a PostBack Trigger with the asp:UpdatePanel "updPnlProductsList" (see code below). <asp:Panel ID="pnlProductsList" runat="server" Visible="false"> <asp:UpdatePanel ID="updPnlProductsList" runat="server" UpdateMode="Conditional"> <ContentTemplate> <div class="featured"> <h3>Product listing</h3> <div class="product clearfix"> <asp:DataList ID="productsList" runat="server"

Stop ASP.NET PostBacks Showing As Separate Pages?

和自甴很熟 提交于 2020-01-05 07:29:10
问题 I have an ASP.NET form that the user can make lots of changes to, each time they make a change the page PostsBack and the details are updated. If the user hits the browser back button they go back through all the previous versions of the page. Is it possible to stop each PostBack being treated by the browser as a new page? So the would make any changes they like and if they hit the back button it brings them to the previous form and not the same form but a different version? I know I could

How to verify which LinkButton is clicked in asp.net on a Page_Load

柔情痞子 提交于 2020-01-05 04:09:56
问题 How do I check which LinkButton is clicked in the Page_Load of the page. This is to avoid calls to service so that it only executes what is present in its event. 回答1: The only thing that should be running in your Page_Load is the code you want to happen always with everyt request, OR have the code that you only want to run once wrapped in a post back check. For example: protected void Page_Load(object sender, EventArgs e) { // Put the all code you need to run with EVERY request here // Then

Jquery Mobile: Getting a cancelled Postback that's causing a page load error

限于喜欢 提交于 2020-01-04 02:57:09
问题 So, I've been trying to get this page working for a couple of days now, when I clicked the send button it would work, but if you tried to hit enter it would just do a postback to the same page. Yesterday I thought I finally got it so it would work on chrome (it has been working just fine on firefox, but breaking on chrome/safari and it is an app for the iphone). But, even though I finally got it so it would change pages, it is now displaying an error. I narrowed down the cause to a postback

CheckboxList not setting Selected with Viewstate disabled

六眼飞鱼酱① 提交于 2020-01-03 18:49:28
问题 I have a CheckboxList that seems to load and do everything right, except for when I do a postback, it will not have the Item.Selected property set. I have viewstate disabled for the entire page. I load it like so(inside Page_Load on every load): foreach (DataRow service in d.Tables[0].Rows) { cblServices.Items.Add(new ListItem((string)service["description"], service["id"].ToString())); } My markup is simple: <asp:CheckBoxList runat="server" ID="cblServices" Width="300px"></asp:CheckBoxList>

ASP.Net — <select> items not being posted back after jQuery populates list

放肆的年华 提交于 2020-01-03 16:56:27
问题 I have an ASP.Net ListBox that I'm trying to populate via jQuery, using the following snippet: $("#MyList_btnAddAll").click(function(e) { e.preventDefault(); $('#MyList_lstAll option').appendTo('#MyList_lstSelected'); }); The code has two ListBoxes in fact, one a "source" and the other a "destination". As you can tell above the ListBoxes are MyList_lstAll and MyList_lstSelected. These are rendered in the browser as elements, as you'd expect. The jQuery is working great, the items are moving

Tracking purchase of particular product on different sites

倾然丶 夕夏残阳落幕 提交于 2020-01-03 14:00:48
问题 I have a website on which other websites owner can list their products. For listing the product they need to manually create the product by providing title , description , image and link of products. When any user will visit my website he will be able to view these products and on click of any product he will be redirected to the owner's website and purchase will be done on his website. Now I need to build a functionality by which I can track the complete transaction of the sale of that

Tracking purchase of particular product on different sites

ぃ、小莉子 提交于 2020-01-03 14:00:07
问题 I have a website on which other websites owner can list their products. For listing the product they need to manually create the product by providing title , description , image and link of products. When any user will visit my website he will be able to view these products and on click of any product he will be redirected to the owner's website and purchase will be done on his website. Now I need to build a functionality by which I can track the complete transaction of the sale of that

ASP.NET hidden field not updating after postback

断了今生、忘了曾经 提交于 2020-01-02 06:11:28
问题 I have some code on my ASP page which looks like this: <asp:UpdatePanel runat="server" id="updatepanel1" UpdateMode="Conditional" onload="updatepanel1_Load" ChildrenAsTriggers="false"> <ContentTemplate> <asp:HiddenField id="sendingRequest" runat="server" Value="0" /> .... </ContentTemplate> </asp:UpdatePanel> I also have some javascript on my page which does this, to trigger the update of the updatepanel: var sendingRequest = document.getElementById("<%=sendingRequest.ClientID%>");