.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

ASP.NET: Develop Polished Web Form Controls the Easy Way with the .NET Framework

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

Pre-built custom controls make application design easier and faster and allow you to maintain UI consistency. However, prepackaged controls can be big and slow, and are OS-specific. For those who don't want to use prepackaged controls, Visual Studio .NET provides controls for Web Forms similar to those found in Windows Forms, including label and textbox, and new additions such as the DataGrid, all of which you can customize. If you want to design your own controls, the .NET Framework provides inheritable classes that take care of all the nasty stuff you want to avoid, including page lifecycle, maintaining state across invocations, and browser detection. This article discusses these concepts, as well as eventing, rendering, and client-side scripting.

David S. Platt

MSDN Magazine June 2002

View Complete Post

More Related Resource Links

UI on the Fly: Use the .NET Framework to Generate and Execute Custom Controls at Run Time


Creating UI controls on the fly can be accomplished via run-time code generation. And there are lots of reasons to do so. Generating these controls once and then reusing them as needed is more efficient than generating the controls each time. Read on.

Morgan Skinner

MSDN Magazine December 2005

Windows Forms: Developing Compelling User Controls that Target Forms in the .NET Framework


In the beginning, writing controls meant dealing with Windows messages. Then came Visual Basic controls, which introduced methods, properties, and events. Later, ActiveX controls, which ran atop COM, became popular. While each innovation in control writing brought more flexibility, nothing has matched the versatility of the new .NET Windows Forms controls and Web Forms controls. This article, the first of a two-part series, introduces the reader to Windows Forms, beginning with their inheritance from one of the .NET CLR base classes, which makes control creation much faster than before. Control programming is illustrated through the development of a login control. The equally flexible Web Forms controls will be covered in Part 2.

David S. Platt

MSDN Magazine April 2002

ASP.NET: Selectively Enable Form Validation When Using ASP.NET Web Controls


Sometimes the extra controls that come with Visual Studio .NET can be a bit inflexible or they just don't provide enough functionality or flexibility for all situations. The ASP.NET form validation controls, while powerful and easy to use, require that the entire page be valid before it's submitted back to the server. Through the use of the new object-oriented features of Visual Basic .NET, it is possible to extend their functionality to overcome this limitation. This article tells you how and helps you decide when it's a good idea to keep validation on the client and when you'd be better off disabling it.

James M. Venglarik II

MSDN Magazine April 2002

Windows CE: Develop Handheld Apps for the .NET Compact Framework with Visual Studio .NET


Smart Device Extensions (SDE) for Visual Studio .NET allow programmers to develop applications for the .NET Compact Framework, a new platform that maintains many of the features of the .NET Framework in a version optimized for handheld devices. This article shows how SDE provides access through Visual Studio .NET to a variety of .NET classes for devices running Windows CE, including classes for creating user interfaces. Data access classes and Web Services for the .NET Compact Framework are also explained. Following that overview, a sample Web Service called XMLList is built. Then the UI-the XMLList client-side application-is created.

Larry Roof

MSDN Magazine March 2002

Which Framework Should You Use?: Building ActiveX Controls with ATL and MFC


Currently MFC and ATL represent two frameworks targeted at different types of Windows-based development. MFC represents a simple and consistent means of creating standalone apps for Windows; ATL provides a framework to implement the boilerplate code necessary to create COM clients and servers. The two frameworks overlap in their usefulness for developing ActiveX controls. We'll take a look at both frameworks as they apply to creating ActiveX controls-highlighting strengths and weaknesses, and walking through the process of creating a control-so you can determine when you might want to use one framework or the other.

George Shepherd

MSDN Magazine April 2000

What is the easiest way to reset all the values of controls on a web form (vb.net) to their defaults


What is the easiest way to reset all the controls on a web form.  Can I set "veiw state" to false for all of the controls with one command, do a response-redirect to its own page, and set view state back to true.  What is the easiest way to do it.



Enabling/disabling input controls in a form

I am writing a ASP.NET UserControl and I am trying to incorporate JQuery into this.
The control is a simple form with a few input fields (text, checkbox, select, radio).
The first element in the form is a checkbox. Upon clicking this checkbox I want the all the input elements in the form (except the checkbox control itself) to be enable/disable. I tried writing some of this code but my solution was not getting me anywhere.
Below is the ASP.NET form code. I'd appreciate the help with some code or pointers into what I am doing wrong.
 <asp:Panel ID="pnlInputControls" runat="server">
    <table style="width:100%;">
            <td style="width:50%">
                <asp:CheckBox ID="chkBenefitName" runat="server" Checked="true" TextAlign="Right" ClientIDMode="AutoID" style="padding:0 0 0

this.controls.add - not always adding to parent form

My current code (snippet below) iterates through user info and adds the same custom control to a form based on how many "Meals" (1-6) the user has selected.  It appears that all even # controls (the second, fourth and sixth) are added to the previously added control, rather than the parent form, when I later try to dispose the controls by iterating through this.controls, only 1, 3 and 5 appear, the others appear as children to 1, 3 & 5. I've reduced controls size, etc. to make sure they're not overlapping (if that can force inheritence?) but no luck.  Anyone have suggestions on what to look at or other guidance? public void drawMealPanel(Meal m, int x, int y) { Controls.MealDisplay md = new Controls.MealDisplay(m); md.Name = m.name; md.Tag = m.id.ToString(); md.Left = x; md.Top = y; md.DragDrop += new System.Windows.Forms.DragEventHandler(this.MealView_DragDrop); md.DragEnter += new System.Windows.Forms.DragEventHandler(this.MealView_DragEnter); this.Controls.Add(md); }

mdi form sub controls transparency C#

Hey there! Im having a panel with 2 Textboxes and a picturebox with a round corner image. The Panel is transparent so that the picturebox gives a round corner background(see image link) Now, my problem ist, that i need a mdiclient as form, and now the panel transparency doesn't work anymore. Making the panel color like the background color will not work, because i use a gradient as mdiclient background. Hope anyone can help me and understand what im trying to tell you. Image: http://img801.imageshack.us/img801/5325/unbenanntrr.jpg Thanks in advance

Populate Form Control from xml File -- Easy way--please

Hi All,Is there any easy way to populate control on .net page using xml file? I have below xml file and i need to generate control accordingly using VB language. <dive id="div1" title="genera information" > <fieldgroup id="iduser" title="User Information"> <field id="txtusername" title="UserName" type="Text" maxval="14"> </field> <field id="txtpws" title="passwprd" type="Text" maxval="14"> </fieldgroup> <fieldgroup id="pinfo" title="Personal Info"> <field id="idsex" title="Select Sex" type="Choice"> <option id="1" value="Male"></option> <option id="2" value="Female"></option> <option id="3" value="Other"></option> </field> <field id="idcomb" title="Country" type="Combo"> <option id="1" value="China"></option> <option id="2" value="India"></option> <option id="3" value="Nepal"></op

easy access to variable in MVC, and Web Form?


Hello everybody,

Recently, I have read an excellent tutorial from asp.net, MVC music store.

I have discover that we can access to variable in strongly typed views like this:

<ul> <% foreach (string genreName in Model.Genres) { %>
<li> <%: genreName %>
</li> <% } %>

It is very powerful!

Can we do the same with Web Form in aspx pages?

I ask this question because I think that ASP controls for data are very strict like gridview; in fact my real problem is that I want to make a loop in my apsx code and I think that I can't in Web form...

Adding Controls dynamically in the infopath form - A standard Expense Entry scenario



I am having a requirement where I need to create an Expense Report Entry form using Infopath 2010. 

1) The form would have pre-defined columns/Controls like Exp.Type(drop-down) , Details , Location, Amount , Curruncy, Date etc..

2) User can enter/update as many line items as possible by clicking Add/Update/Delete for the each line items. So basically its like adding the same row dynamically.

3) When User Submits, I need to capture this data and post it to SAP where I am using SAP web Services.

Can you please suggest if this is possible in InfoPath form ?

If Yes, how can I achieve this dynamic line items functionality in InfoPath

And how can I read the data using the code so that I can Post it to the WebService? 

Gridview Paging resets form controls


Hi all,

I have a gridview which has 4 columns, each holding an ImageButton in a templateField column. When I click on one of these image buttons the clicked upon image is displayed in Image1 using GridView1_RowCommand and this works fine.

However, when I click on one of the page numbers on the gridview the Image1 control resets to its original state and loses its ImageUrl.

Below is the HTML source for the gridview.

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
AutoGenerateColumns="False" DataSourceID="sqlImages" PageSize="1"
<asp:ImageButton ID="ImageButton1" runat="server" Height='75px' Width='150px' ImageUrl='<%# Eval("Col1") %>' CommandArgument='<%# Eval("Col1") %>' />
<asp:ImageButton ID="ImageButton2" runat="server" Height='75px' Width

Adding controls to a form dynamically


How to add checkboxes at a particular positon in a application dynamically.

That is ,I want to add checkboxs depending on the no of items in a collection and i even want to name it.How can i do it?

Can i get any sample code for it?

How to set alignments of form controls dynamically.

I have a form containing two panels. In both panels there are two labels and textboxes. I set the 'Center In Form' property of the labels and textboxes to 'Horizontally' and 'Vertically' in design time respectively. But as the form is resizable, when the size of the form is increased or decreased at runtime the controls are no longer center aligned in the panels. How can I handle this problem (provided the main form needs to remain sizable)? Please help.
Thanks in advance

Each AccordionPane with form containing controls with validation


Hey all,

I am using Accordion with multiple AccordionPane. Each AccordionPane has a form tag that contains asp controls such as dropdownlist and textboxes and buttons to submit or cancel. Each asp control has a requiredFieldValidator assign to it.  However when a i am in a particular AccordionPane to submit the form, the validator for other fields in other fields is highlighted preventing me from submitting.


Pleaseeee provide me with some assistance or light on what the problem is.  I have deadlines today.




Place controls on form (WinForms C#)


Hello! I cannot place controls on form and set them to be resized on resizing whole window (or when it is maximized).

I have a ListView at the bottom (docked to bottom border), a TabControl at the leftside (docked left) and all other area should be filled by one more control - WebBrowser. But if I dock it to FILL all area it goes behind tabcontrol and listview... what am I doing wrong here?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend