Sunteți pe pagina 1din 2

1/4/12

Page Utilit class to reset all Te tBo and DropDo n in eb page


Follo us on T itter Join us on Google Plus Follo us on Facebook

Liked s?

TotalDotNet
Tutorials Videos Article Codes Tips Forums Interview Submit Your Code

Page Utilit class to reset all Te tBo and DropDo n in eb page (Vie ed - 691 times)

Below is the Page utility class that you can use in ASP.Net application to reset the all the TextBox and DropDownList in the aspx page. using System; using System.Web.UI.WebControls; using System.Web.UI; using System.Web; public class PageUtility { public static void ResetControl(Control mainControl) { foreach (Control c in mainControl.Controls) { if (c is TextBox) { TextBox t = (TextBox)c.FindControl(c.ID); t.Text = string.Empty;

if (c is DropDownList) { DropDownList ddl = (DropDownList)c.FindControl(c.ID); if (ddl.Items.Count > 0) { ddl.SelectedIndex = 0;

// Add logic to more control that yu want to reset if (c.HasControls()) {


.totaldotnet.com/Code/Sho Code18_ResetTe tbo Dropdo n.asp 1/2

1/4/12

Page Utilit class to reset all Te tBo and DropDo n in eb page

ResetControl(c);

//Reset TextBoxes and Dropdowns

You can call the above function from code behind of ASPX page like this PageUtility.ResetControl(this);

O he Code
Code for Using Cookies in ASP.Net application Code to convert Javascript JSON to C# Type Code to convert file to byte array in Csharp Javascript code to check Silverlight in local system C# function to check if the date is a weekend or weekday Lambda Expression code with GroupBy extension method Lambda Expression code to show Immediately execution and Delay execution Lambda Expression code with Select and Where combine Lambda Expression code to return Anonymous Type Lambda Expression code use with 'Select' extension method Lambda Expression code to get first matching result from string array CSharp Lambda Expression code to filter integer list Check C# window app running on Admin account or not Code to use C# Wake on Lan (To invoke System connected on LAN) Remove all HTML tags from input string Get assembly attributes and Reference using C# Use Aggregate extension method (LinQ) C# code to download image from other website Code to convert List or IList to ObservableCollection Copyright (c) 2011 TotalDotNet.com. Navigation - Code Search engine optimisation (seo) by building free links Silverlight Page Flip Link Exchange Code to show different color columns in chart control in Silverlight How to Popup a Browser Window in silverlight Code to Writing to Windows Event Log How to use the SqlTransaction in C# How to Set Browser Cookies in Silverlight. Authentication from ASP.NET application against Active Directory Code to call C++ functions in a DLL using C# Using the .NET Stopwatch class in CSharp (C#) Dynamically set position of HTML element using jQuery Code to enumerate embedded resource names in C# Using Delegate to check the item in the Generic list in C# Declare nullable integer and datetime datatype type in CSharp ( C# ) Populate DropDownList inside GridView/DataGrid in ASP.Net Export DataSet data to xml file (Create xml file from Dataset) Import Excel Data into Sql Server Using SqlBulkCopy-ASP.NET (C#) Code to use Ajax ModalPopUpExtender in ASP.Net application Grabbing First Frame in Silverlight Code to get first day of the month in SQL Server (T-SQL) Code to get last day of a particular month Show google map in your web site Create Trim function in JavaScript How to Write a Palindrome Programme using C#? C# code to convert HashTable into ArrayList
.totaldotnet.com/Code/Sho Code18_ResetTe tbo Dropdo n.asp 2/2

S-ar putea să vă placă și