postback

@ViewScoped creating new instance on every postback

眉间皱痕 提交于 2019-12-06 12:36:31
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; public FileController() { System.out.println(" In file Controller constructor"); ServletContext

HiddenField value modified by javascript is not posted back

与世无争的帅哥 提交于 2019-12-06 12:27:02
问题 This is weird, but I've been using this method all over my code: I have dropdown lists that I populate client-side, using callbacks and because of this I'm unable to access their selected values from code behind and using a hidden field to store selected value in it. I had no problem retrieving the hidden field's value on postback, but all of a sudden it stopped working and is always blank, even when the value on client side is present. Any thoughts? P.S. I'm not setting or resetting hidden

ASP.Net Button not raising postback

a 夏天 提交于 2019-12-06 12:20:13
问题 I've a simple page in one of our web applications, which has the following markup: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewUpload.aspx.cs" Inherits="Mass_Upload.NewUpload" MasterPageFile="~/Master" Title="Document Mass Upload" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <link rel="Stylesheet" type="text/css" href="./../CSS/ScrollingTable.css" /> <script type="text/javascript" src="../Help/HelpPopup.js" /> </asp:Content> <asp:Content ID=

How do I get my WebGrid to POST instead of GET during a sort or paging operation in my MVC4 site?

最后都变了- 提交于 2019-12-06 11:53:56
问题 I have a fairly simple site with a Search partial view and a Listing partial view. They're rolled up using multiple models into the Index view. Everything is fine. Except when I click the grid column headers to sort or attempt to page to the next listing of data, the grid comes back empty. If I re-submit the same search criteria, then the grid repopulates with all applicable data sorted or paged properly. I've tracked this behavior down to the fact that the WebGrid sets up it's paging and

Not allow resubmit of page

戏子无情 提交于 2019-12-06 11:32:56
I have an ASP.NET 4.0 web form. There is a textbox I want users to submit and check. If it's correct, I blank out the textbox and don't want users to be able to resubmit that data. In IE8, users can hit back (get a resubmit warning) and if they refresh, it will resubmit the data from that text box. I've tried setting the value to null and disabling viewstate for the textbox. How do I stop resubmit? You can implement the Post Redirect Get pattern as detailed here on Wikipedia to remove the refresh and double postback. If it's absolutely vital that submissions never get processed twice, combine

Which one is better? Ajax post or page post[Controller httppost] when only one form is there in a page?

久未见 提交于 2019-12-06 08:02:33
I have a page called Bookprogram which contains 6 input controls namely, txtName, txtEmail, txtPhone, selectcat[dropdown for categories], txtDate, txtMessage. Now when am done with all the validations for the above control, I want to store the data in db. I know how to perform both in ajax as well as complete page posting. If it's in ajax, after validations, I would just call $.ajax and post the data as a string and fetch it in controller as below: [HttpPost] public JsonResult BookProgram(string name, string email, string phone, string category, string date, string message) { //code to save

asp.net: Postback disabled after validation failed

牧云@^-^@ 提交于 2019-12-06 07:47:18
问题 After validation failed, I have a problem with controls (dropdownlist or button) that should cause a new postback. I will try to explain it clearly... The purpose of my page is to save fives dates in a database. The page has the following controls: Five textboxes, each one containing a date A reset button (CausesValidation=false) to restore a default date in one of the 5 textboxes A dropdown list (AutoPostback=true, CausesValidation=false) of predefined templates that applies 5 dates to the 5

ASP.Net viewstate questions on form postbacks

强颜欢笑 提交于 2019-12-06 07:19:28
Let's assume I have a very simple form, with a submit button and a dropdown list. When I change the list entry and hit submit, at what stage in the postback processing does the viewstate reflect my changed list entry? According to O'Reilly's Learning ASP.Net 3.5, there are two loads taking place-- one before form validation and another after (diagram on page 266 for those with a copy). According to the diagram the viewstate is loaded during the first load stage, before the validation. I assume my changed dropdown is reflected at this point? Also, according to the diagram, posted data is

DataGrid button - Invalid Postback or Callback

此生再无相见时 提交于 2019-12-06 06:10:32
I have setup a DataGrid with a number of columns and a checkbox and column at the end of the row. I am also changing the layout of the datagrid on the OnItemCreated event which changes the layout of the datagrid by expanding the rows with the "Rowspan" attribute and remove the extra columns and controls where they are no longer required. The original datagrid layout was setup like this: ___________________________________________ | 1 | Employee Name | 01/08/10 |[] |[SAVE]| | 1 | Employee Name | 02/08/10 |[] |[SAVE]| ___________________________________________ | 2 | Employee Name | 01/08/10 |[]

FileUpload control clears itself

丶灬走出姿态 提交于 2019-12-06 05:41:22
问题 I'm having some trouble with the FileUpload control and was wondering if I could get some help. On my page I have a FileUpload control, and a drop down list. So the user browses to the file they want, and then select an option from the drop down (which enables some checkboxes that are also on the page for use, depending on what they select in the drop down). This causes the FileUpload control to become empty, and now the user must browse to the file they wanted again. Is there anyway to