.NET news » Search results
Search results for query "form" (46):
Prevent Users from Submitting a Form Twice
When a user clicks a submit button in a form, their browser makes a request back to the web server for the specified URL. On the web server, the user's input is processed and some action is taken based on the input. A database record might be added, an email might be sent, and so on. One potential issue that can arise is if a user submits a form, but there is a delay in getting back a response from the server. A user may think that the button click didn't "take", so they click it again. This can lead to two form submissions, resulting in two database records being added, two emails being sent, or whatever. Two possible methods to prevent it described in the atricle.
Wizard Form Implementation
Creating Validator Controls for the CheckBox and CheckBoxList
ASP.NET provides a variety of validation Web controls that can be used to validate a user's form field inputs. Unfortunately, the validation
Web controls do not work with the CheckBox or CheckBoxList Web controls. If you set a validation control's ControlToValidate
property to the ID of a CheckBox or CheckBoxList, the page will throw an HttpException, stating:
"Control 'controlID' referenced by the ControlToValidate property of 'validationControlID' cannot be validated."
There may be times, however, when you need to provide validation for a CheckBox or CheckBoxList. Many Web pages with Terms of Service include a CheckBox titled "I agree to the above terms" that must be checked before continuing. Likewise, a Web Form may contain a set of options in the form of a CheckBoxList. Perhaps the user is required to check at least one of these options before continuing.
In this article we'll create two custom server controls, CheckBoxValidator and CheckBoxListValidator. The download at the end of this article includes both the entire source code and a compiled assembly that you can drop into your ASP.NET 2.0 web applications..
Creating a Multi-Page Windows Forms Control with Design Time Support
Persisting Page State in ASP.NET 2.0
Page state, commonly referred to as view state, is persisted in a hidden form field, by default. When a page is being rendered, any programmatic changes to a control's state is saved to the page's overall view state. During the rendering stage, this view state is serialized into a base-64 encoded hidden form field and sent down to the client's browser. On postback, the view state data is sent back to the web server, where it is deserialized and returned to the appropriate Web controls in control hierarchy so that they may re-establish their state as it was prior to the postback.
View state provides a slick way to remember state in a stateless client-server model and it happens underneath the covers without any extra effort from page developers. The downside of view state, however, is that in certain situations the view state can grow to be exceedingly large. A large view state requires a longer page download time since it bloats the total web page size and also affects the postback time, since the entire view state content must be posted back to the web server along with the other form fields.
It is possible, however, to persist view state to an alternate medium. Such customizations were possible in
ASP.NET 1.x by overriding a couple of methods in the
Page class. ASP.NET 2.0 makes customizing page state persistence
easier as this logic is handled through a separate class. In this article we'll explore the built-in page state persistence options
in ASP.NET 2.0, which includes the ability to persist page state to session state rather than through a hidden form field.
Three Business Decisions for Mobile Application Development
read more
Filling in PDF Forms with ASP.NET and iTextSharp
The Portable Document Format (PDF) is a popular file format for documents. PDF files are a popular document format for two primary reasons: first, because the PDF standard is an open standard, there are many vendors that provide PDF readers across virtually all operating systems, and many proprietary programs, such as Microsoft Word, include a "Save as PDF" option. Consequently, PDFs server as a sort of common currency of exchange. A person writing a document using Microsoft Word for Windows can save the document as a PDF, which can then be read by others whether or not they are using Windows and whether or not they have Microsoft Word installed. Second, PDF files are self-contained. Each PDF file includes its complete text, fonts, images, input fields, and other content. This means that even complicated documents with many images, an intricate layout, and with user interface elements like textboxes and checkboxes can be encapsulated in a single PDF file.
Due to their ubiquity and layout capabilities, it's not uncommon for a websites to use PDF technology. For example, when purchasing goods at an online store you may be offered the ability to download an invoice as a PDF file. PDFs also support form fields, which are user interface elements like textboxes, checkboxes, comboboxes, and the like. These form fields can be entered by a user viewing the PDF or, with a bit of code, they can be entered programmatically.
This article is the first in a multi-part series that examines how to programmatically work with PDF files from an ASP.NET application using iTextSharp, a .NET open source library for PDF generation. This installment shows how to use iTextSharp to open an existing PDF document with form fields, fill those form fields with user-supplied values, and then save the combined output to a new PDF file.


Syndicate