|
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Events of Gridview</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" GridLines="None" ShowFooter="True" AllowPaging="True" DataKeyNames="id"
OnPageIndexChanging="GridView1_PageIndexChanging" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowEditing="GridView1_RowEditing" OnRowDataBound="GridView1_RowDataBound" OnRowDeleting="GridView1_RowDeleting"
OnRowUpdating="GridView1_RowUpdating" Style="text-align: left">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chekSelect" runat="server" Checked='<%# Bind("selectedItem") %>' />
</ItemTemplate>
<HeaderTemplate>
<asp:CheckBox ID="chekSelectALL" runat="server" Text="Select All" AutoPostBack="True"
OnCheckedChanged="chekSelectALL_CheckedChanged" />
</HeaderTemplate>
<FooterTemplate>
<asp:CheckBox ID="chekSelect" runat="server" />
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="sno" HeaderText="SNo" ReadOnly="True" />
<asp:TemplateField HeaderText="Name">
<EditItemTemplate>
<asp:TextBox ID="txtName" runat="server" Text='<%# Bind("uname") %>'></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtName"
ErrorMessage="*"></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%# Bind("uname") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<table width="100%">
<tr>
<td>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName"
ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td align="left">
<asp:Label ID="lblGrandTotalTxt" runat="server" Text="Grand Total"></asp:Label></td>
</tr>
</table>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Marks">
<EditItemTemplate>
<asp:TextBox ID="txtTotalMarks" runat="server" Text='<%# Bind("totalMarks") %>' MaxLength="5"
Width="60px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtTotalMarks"
ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtTotalMarks"
ErrorMessage="*" ValidationExpression="^[0-9]{0,5}$"></asp:RegularExpressionValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblTotalMarks" runat="server" Text='<%# Bind("totalMarks") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<table width="100%">
<tr>
<td>
<asp:TextBox ID="txtTotalMarks" runat="server" MaxLength="5" Width="60px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtTotalMarks"
ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator></td>
<td>
<asp:LinkButton ID="lnkInsert" runat="server" ForeColor="White" OnClick="lnkInsert_Click"
ValidationGroup="a">Insert</asp:LinkButton></td>
</tr>
<tr>
<td align="left" colspan="2">
<asp:Label ID="lblGrandTotal" runat="server"></asp:Label></td>
</tr>
</table>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a Software Engineer from Bhopal. I started my Career from Programming in ASP and now working as a Web Developer in ASP.Net (C#). I Love coding and always ready to gain new thing and always been towards Microsoft Technologies. Apart from coding my other hobbies are traveling, Internet Surfing, spending time with family and hang out with friends.
http://www.webtekspace.blogspot.in/