Why use web forms?
The most obvious place for using web forms in a DataGrid is for editing. It can give you stricter control over the data that you can input, but you are not just limited to editing. I'll show you throughout this article where you can put them in for normal viewing.
Before we begin
For all of these examples we'll be using the following DataGrid -
<asp:DataGrid id="dg" runat="server" Bordercolor="black" gridlines="vertical" font-names="Arial" font-size="10pt" HeaderStyle-BackColor="#FFCC00" ItemStyle-BackColor="#FFCC66" AlternatingItemStyle-BackColor="#FFFFFF" AutoGenerateColumns="False"> <Columns> </Columns> </asp:datagrid> |
Live Demo |
Note - To see the code used to create the datasource for all this, click here.
Note - You may need to add some event handlers later on.