postback

ASP.Net page enter key causing post back

岁酱吖の 提交于 2019-12-17 10:40:32
问题 I have an aspx page that postsback when it should not. there are two text boxes, two listboxes and two buttons on the page. if at any-point the enter key is pressed the first button is given focus and "clicked" resulting in a loss of selection within the listboxes. How do I disable this? There are tons of tutorials on how to capture the enter button and execute a method but I could not find one on how to simply disable the neat "let me grab the first button I find and click it" feature

ASP.NET MVC doesn't work with ViewState and Postback?

*爱你&永不变心* 提交于 2019-12-17 10:31:59
问题 Perhaps this is a naive question. In my understanding, ASP.NET MVC cannot work with ViewState and Postback which is fundamentals of ASP.NET forms. Is that correct? If that's it, then all ASP.NET Web Controls depending on ViewState & Postback cannot be used in ASP.NET MVC, right? 回答1: ASP.NET's server-side controls work with WebForms, not MVC. MVC doesn't use controls in the traditional ASP.NET sense (at least yet). The MVC model is quite different from the WebForms model; not better or worse,

ajax “loading” icon with UpdatePanel postbacks

≡放荡痞女 提交于 2019-12-17 09:49:51
问题 I have a form that is being dynamically built depending on user selection using Ajax (built in .NET Ajax with UpdatePanel). how can I insert a "standard" ajax loading icon (maybe have it attached to the mouse pointer) while the postback is happening then remove it when the post back is finished? I do have the AjaxToolKit installed if that helps. 回答1: use updateprogress of tool kit :hope this will help you <asp:updatepanel id="ResultsUpdatePanel" runat="server"> <contenttemplate> <div style=

ajax “loading” icon with UpdatePanel postbacks

懵懂的女人 提交于 2019-12-17 09:49:07
问题 I have a form that is being dynamically built depending on user selection using Ajax (built in .NET Ajax with UpdatePanel). how can I insert a "standard" ajax loading icon (maybe have it attached to the mouse pointer) while the postback is happening then remove it when the post back is finished? I do have the AjaxToolKit installed if that helps. 回答1: use updateprogress of tool kit :hope this will help you <asp:updatepanel id="ResultsUpdatePanel" runat="server"> <contenttemplate> <div style=

Is it possible to disable f:event type=“preRenderView” listener on postback?

别来无恙 提交于 2019-12-17 07:26:46
问题 Is it possible to "disable" triggering of this action when doing postback? <f:metadata> <f:event listener="#{defaultNewQuestionHandler.init}" type="preRenderView" /> </f:metadata> 回答1: That's not possible with <f:event> . You need to manually check FacesContext#isPostback() inside the listener method. public void init() { if (!FacesContext.getCurrentInstance().isPostback()) { // ... } } In the upcoming JSF 2.2 <f:viewAction> tag, which is supposed to replace this <f:event type="preRenderView"

A potentially dangerous Request.Form value was detected from the client

徘徊边缘 提交于 2019-12-17 07:24:08
问题 I have this issue. I have tried everything. ValidateRequest="false".. and decoding and encoding html.. etc. etc.. What I need is a popup box (so im using ModalPopupExtender) to present to a user where people can type in xml settings and click ok/cancel button to close the popup and save. However i keep on getting this error "A potentially dangerous Request.Form value was detected from the client".. Here is my test code below (quick example of my scenario and error).. <%@ Page Language="C#"

How do I make a Textbox Postback on KeyUp?

╄→гoц情女王★ 提交于 2019-12-17 07:18:37
问题 I have a Textbox that changes the content of a dropdown in the OnTextChanged event. This event seems to fire when the textbox loses focus. How do I make this happen on the keypress or keyup event? Here is an example of my code <asp:TextBox ID="Code" runat="server" AutoPostBack="true" OnTextChanged="Code_TextChanged"> <asp:UpdatePanel ID="Update" runat="server"> <ContentTemplate> <asp:DropDownList runat="server" ID="DateList" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID

ListItems attributes in a DropDownList are lost on postback?

自作多情 提交于 2019-12-17 03:34:42
问题 A coworker showed me this: He has a DropDownList and a button on a web page. Here's the code behind: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ListItem item = new ListItem("1"); item.Attributes.Add("title", "A"); ListItem item2 = new ListItem("2"); item2.Attributes.Add("title", "B"); DropDownList1.Items.AddRange(new[] {item, item2}); string s = DropDownList1.Items[0].Attributes["title"]; } } protected void Button1_Click(object sender, EventArgs e) {

@ViewScoped bean recreated on every postback request when using JSF 2.2

守給你的承諾、 提交于 2019-12-17 03:18:15
问题 I'm having an issue similar to this post and the answer from @BalusC with 3 solutions but: I'm not using of the mentioned EL expressions I don't want to go with the second solution (it's complex enough for me like this) and partial state saving is set to false. My code is as follows: index.xhtml : <?xml version="1.0" encoding="windows-1256" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml

@ViewScoped creating new instance on every postback

时光毁灭记忆、已成空白 提交于 2019-12-14 03:44:16
问题 I am having the below managed bean. But every time I do a post back to the same bean ie while calling updateFileList. I get a new instance of FileDAO. How can I prevent this? Is it safe to have a DAO inside a managed bean, if not what changes can I make to better it. @ManagedBean(name = "file") @ViewScoped public class FileController implements Serializable { private static final long serialVersionUID = 1L; private List<LoadFileLog> fileList = null; private Date selectedDate; FileDAO fileDAO;