postback

Stop postback on TextChanged

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 08:54:03
问题 I have a textbox in an aspx page that has a TextChanged event attached to it. I also have a validator attached to the textbox. When the text is changed, the validate triggers but in case there is an error the textchanged event is still called. Do you know if it's possible to stop the postback on textchanged if the validator fires? <asp:TextBox ID="txtQuantity" runat="server" AutoPostBack="true" ontextchanged="txtQuantity_TextChanged"></asp:TextBox> <asp:RequiredFieldValidator ID="reqQuantity"

GridView loses data during postback

久未见 提交于 2019-12-19 06:40:23
问题 I have an aspx.Page containing a gridview. The gridview is bound in code behind to a datasource only when no postback takes place and has enableviewstate = true (The page too). During a postback, the data bound to the gridview are lost. What could be the reason. Please ask if code is needed. 回答1: Solved it, problem was I made a Page.Databind() in the Page_Load event of the masterpage of the page with the gridview, so it bound the gridview during each postback without data. Thanks for all

Updatepanel gives full postback instead of asyncpostback

人走茶凉 提交于 2019-12-19 06:07:51
问题 I have run into what seems to be a very famous problem: My updatepanel fires a full postback instead of a async postback. The normal solution is to give all controls you add dynamically an ID, which I have done, but I still get a full postback instead of my async postback... Here's the code: HTML: <asp:UpdatePanel ID="ItemsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False"> <Triggers> </Triggers> <ContentTemplate> <asp:ListView ID="PlayerItems" runat="server"

ASP.NET - Is it possible to trigger a postback from server code?

六眼飞鱼酱① 提交于 2019-12-19 05:19:54
问题 Is it possible to to programmatically trigger a postback from server code in ASP.NET? I know that it is possible to do a Response.Redirect or Server.Transfer to redirect to a page, but is there a way to trigger a postback to the same page in server code ( i.e. without using javascript trickery to submit a form)? 回答1: Asp.net Postbacks are initiated from the client (typically form submission). I am not sure what you are trying to achieve. Some of the server side page lifecyle events are

Is there a difference between an F5 browser refresh and postback??(asp.NET)

为君一笑 提交于 2019-12-19 04:22:18
问题 I am dynamically creating dragrids in different rows of an existing datagrid in asp.NET My generated datagrids have a column which is TemplateColumn (a CheckBox Column). In my parent datagrid, I have a template column with checkboxes. when I check or uncheck the value of the check box, the check_change method is called (autopostback is set to true), the dynamically generated datagrids lose the checked checkboxes (the checkboxes are all unchecked again). However, if i check any of the

How to maintain scroll position on autopostback?

江枫思渺然 提交于 2019-12-18 14:06:05
问题 How can I get back to the same position of a page on postback . It always seems to get to the top of the page. I've tried using maintainScrollPositionOnPostBack = "true" But its not working. 回答1: I've recently looked for this as well. Came up with a load of Javascript to be inserted until I found the following: At the top of your .aspx codefile, insert the following: MaintainScrollPositionOnPostback="true" so the very first sentence in your .aspx starts <%@ Page Language="C#"

@ViewScoped Managed bean loads many times during postback

血红的双手。 提交于 2019-12-18 13:26:14
问题 I have a calendar, editor, fileUpload and a dataTable primefaces controls on a jsf facelet. Code is as follows, <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" template="./../templates/masterlayout.xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:f="http://java.sun.com

ASP.net Postback - Scroll to Specific Position

谁都会走 提交于 2019-12-18 12:53:34
问题 I have an ASP.net WebForms page that has a lot of content on the top of the screen. It has a link button that will post back to the page and show another section of the page. When the page refreshes, I would like to set focus and scroll down to this section of the page. I tried doing txtField.Focus() in my code behind and it will set focus and try to scroll there, but then scrolls right back to the top. The focus is still on my text box but the position of the screen is at the very top. The

Refresh the page after a postback action in asp.net

半城伤御伤魂 提交于 2019-12-18 12:16:42
问题 I have command button added in my asp.net grids. After performing an action using that button, we refresh the grid to reflect the new data. (basically this action duplicates the grid row). Now when user refresh the page using F5 , an alert message is displayed (to resend the information to server) if we select "retry", the action is repeated automatically. I know this is a common problem in asp.net, how can we best handle this? 回答1: Search for GET after POST - http://en.wikipedia.org/wiki

Webforms Refresh problem

自古美人都是妖i 提交于 2019-12-18 09:37:31
问题 This is probably a simple question for every WebForms developer but I am knew to this scene. I have a page that has an "ADD" button on it that results in a jquery popup where the user can submit a form that will add an entry to the repeater on the page. My problem is that after the user adds an item, if they then hit the refresh button the item will get added again. I can't stop this with the page.ispostback because that would block the original add. What can I do here? 回答1: that's a common