How to create Header "Full Name" in GridView when I am creating "TemplateField" with hyperlinks ? For example I want these rows in TemplateField to have header "Full Name".
<asp:GridView ID="CustomersGridView" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("FirstName") + " " + Eval("LastName") %>'
NavigateUrl="CarTest.aspx" > </asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Use the header template:
<Columns>
<asp:TemplateField>
<ItemTemplate>
....................
</ItemTemplate>
<HeaderTemplate>
Full Name
</HeaderTemplate>
</asp:TemplateField>
</Columns>
For more information, read.
<asp:GridView ID="CustomersGridView" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderText="Full Name">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("FirstName") + " " + Eval("LastName") %>'
NavigateUrl="CarTest.aspx" > </asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div class="table-responsive">
<asp:GridView ID="grdDisCategry" runat="server" CssClass="table table-small-font table-bordered table-striped" Font-Size="Small"
EmptyDataRowStyle-ForeColor="#cc0000" HeaderStyle-Font-Size="10" HeaderStyle-Font-Names="Arial"
AutoGenerateColumns="False" EmptyDataText="No Record Found" HeaderStyle-ForeColor="#990000">
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>
<asp:TextBox ID="txtMonthsDays" runat="server" class="form-control input-sm m-bot15"
Font-Bold="true" Text='<%#Bind("MonthsDays") %>'></asp:TextBox>
</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="txtMonthDays" runat="server" class="form-control input-sm m-bot15"
Font-Bold="true" Text='<%#Bind("MonthDays") %>'></asp:TextBox>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="80px" />
</asp:TemplateField>
</Columns>
<HeaderStyle HorizontalAlign="Justify" VerticalAlign="Top"
Font-Bold="true" />
<RowStyle Font-Size="Small" Height="1" ForeColor="#000000" Font-Italic="true" />
</asp:GridView>
Related
i have a gridview with pregenerated columns
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px"
CellPadding="4" GridLines="Horizontal">
<RowStyle BackColor="White" ForeColor="#333333" />
<Columns>
<asp:TemplateField HeaderText="MenuID" >
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("MenuID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="MenuParentID" >
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("MenuParentID") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Particulars">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Particulars") %>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="250px" />
</asp:TemplateField>
<asp:BoundField DataField="Options" HeaderText="Options"
ItemStyle-HorizontalAlign="Center" >
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Menu(M)" >
<ItemTemplate>
<asp:CheckBox ID="chkMenu" runat="server" OnCheckedChanged="chkMenu_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Add(A)">
<ItemTemplate>
<asp:CheckBox ID="chkAdd" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit(E)">
<ItemTemplate>
<asp:CheckBox ID="chkEdit" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete(D)">
<ItemTemplate>
<asp:CheckBox ID="chkDelete" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#333333" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
</asp:GridView>
want to fill the grid from database and check/uncheck the checkboxes from database condition. How to fill the gridview ...................................................................................
On which condition you want to check /Un-check the chechbox?
you can write code on RowDataBound event of grid.
void CustomersGridView_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
// here check the condition and find the check box of current row and set it checked/uncheked
}
}
I have a gridview control with paging. Everything is good in IE.
But in Firefox and Chrome, the design breaks because of paging.
I attach the screenshots from IE and Firefox here:
In IE:
In Firefox:
Here is my grid view:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderWidth="0"
AllowPaging="true" ShowFooter="true" PageSize="3" Width="100%" OnPageIndexChanging="GridView1_PageIndexChanging"
OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
OnRowDeleting="GridView1_RowDeleting" OnRowCommand="GridView1_RowCommand" HorizontalAlign="Center">
<AlternatingRowStyle CssClass="gridAlternateRow" />
<FooterStyle CssClass="gridFooter" />
<PagerSettings Mode="NumericFirstLast" />
<PagerStyle HorizontalAlign="Center" CssClass="GridPager" VerticalAlign="Middle" Wrap="False" />
<HeaderStyle CssClass="GridHeader" />
<RowStyle CssClass="gridRow" />
<Columns>
<asp:TemplateField HeaderText="ID" Visible="false">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lbladd" runat="server"></asp:Label>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="From Date" HeaderStyle-Width="10%">
<ItemTemplate>
<asp:Label ID="lblFromDate" runat="server" Text='<%#Eval("FromDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtFromDate" runat="server" Text='<%#Eval("FromDate") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtAddFromDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqFromDate" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddFromDate" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="To Date" HeaderStyle-Width="15%">
<ItemTemplate>
<asp:Label ID="lblToDate" runat="server" Text='<%#Eval("ToDate") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtToDate" runat="server" Text='<%#Eval("ToDate") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox CssClass="myCalCss" ID="txtAddToDate" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqToDate" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddToDate" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Procedure Code" HeaderStyle-Width="15%">
<ItemTemplate>
<asp:Label ID="lblProcedureCode" runat="server" Text='<%#Eval("ProcedureCode") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtProcedureCode" runat="server" Text='<%#Eval("ProcedureCode") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAddProcedureCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqProcedureCode" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" ControlToValidate="txtAddProcedureCode" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="15%">
<ItemTemplate>
<span onclick="return confirm('Are you sure want to delete?')">
<asp:LinkButton CssClass="aDelete" ID="btnDelete" Text="Delete" runat="server" CommandName="Delete" />
</span>
<asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" CssClass="aEdit" />
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update" CssClass="aUpdate" />
<asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CssClass="aSave" />
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="btnInsertRecord" runat="server" Text="Add" ValidationGroup="ValgrpConUNIAnesthesiaFeeSchedule" CommandName="Insert" />
</FooterTemplate>
<HeaderStyle Width="15%"></HeaderStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
I take a look at Firebug and this is what I got in both IE and Firefox. Same HTML.
What am I missing?
I am having a gridview and I have showeditbutton property false, showdeletebutton property true.Edit is a link button and a row command event is fired on clicking it.
Now,my problem is that in gridview, when I click on edit link, delete link gets disappear.
I have written
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" PageSize="5" OnRowCommand="gv_RowCommand"
AllowPaging="true" DataKeyNames="ID" CssClass="mGrid" BackColor="White" BorderColor="Silver" BorderStyle="Double"
BorderWidth="1px" CellPadding="4" >
<RowStyle BackColor="White" Width="150%" ForeColor="#003399" />
<Columns>
<asp:TemplateField HeaderText="ID" Visible="false" >
<ItemTemplate>
<asp:Label ID="lblID" Text='<%#Bind("ID") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Version">
<ItemTemplate>
<asp:Label ID="lblversion" Text='<%#Bind("version") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image ID">
<ItemTemplate>
<asp:Label ID="lblimageid" runat="server" Text='<%#Bind("image_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Getty ID">
<ItemTemplate>
<asp:Label ID="lblgettyid" runat="server" Text='<%#Bind("getty_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Pool Letter">
<ItemTemplate>
<asp:Label ID="lblpoolletter" runat="server" Text='<%#Bind("pool_letter") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="To Use">
<ItemTemplate>
<asp:Label ID="lbltouse" runat="server" Text='<%#Bind("to_use") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Clue">
<ItemTemplate>
<asp:Label ID="lblclue" runat="server" Text='<%#Bind("clue") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Range">
<ItemTemplate>
<asp:Label ID="lblrange" runat="server" Text='<%#Bind("range") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="last_updated">
<ItemTemplate>
<asp:Label ID="lbllastupdated" runat="server" Text='<%#Bind("last_updated") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label ID="lblstatus" runat="server" Text='<%#Bind("status") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First">
<ItemTemplate>
<asp:Label ID="lblfirst" runat="server" Text='<%#Bind("first") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Middle">
<ItemTemplate>
<asp:Label ID="lblmiddle" runat="server" Text='<%#Bind("middle") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last">
<ItemTemplate>
<asp:Label ID="lbllast" runat="server" Text='<%#Bind("last") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
<asp:LinkButton ID="lnkbtnedit" Text="Edit" style="color:#003399;" CommandName="Edit" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="true" CausesValidation="false" />
</Columns>
<PagerStyle BackColor="#006699" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#CCFFFF" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
can I get any help?
You can include the delete button in your ItemTemplate:
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkbtnedit" Text="Edit" style="color:#003399;" CommandName="Edit" runat="server"></asp:LinkButton>
<asp:LinkButton ID="lnkbtndelete" Text="Delete" style="color:#003399;" CommandName="Delete" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
And then just remove the CommandField.
Replace your below code
<asp:TemplateField >
<ItemTemplate>
<asp:LinkButton ID="lnkbtnedit" Text="Edit" style="color:#003399;"
CommandName="Edit" runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="true" CausesValidation="false" />
with this code.
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Top"
HeaderStyle-Width="10%">
<ItemTemplate>
<asp:LinkButton ID="lnkbtnedit" runat="server" CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="btndelete" runat="server" CommandName="Delete" Text="Delete"
CommandArgument="<%#((GridViewRow)Container).RowIndex%>"/>
</EditItemTemplate>
</asp:TemplateField>
I having a problem to make HtmlEncode work properly inside a GridView in ASP.Net. Basically I'm using TemplateField to toggle ItemTemplate and EditItemTemplate to have data entry on the GridView itself. I'm looking for some resource in how I can encode Eval and Bind method in ASP.Net but all of them not work in my end.
here's my code below:
<div id="dvShowContent" runat="server" style="text-align: center">
<asp:GridView ID="dgvSortKey" runat="server" AllowSorting="True" OnRowDataBound="gv_drb"
AutoGenerateColumns="False" AllowPaging="True" BackColor="White" BorderColor="#336666"
BorderStyle="Double" BorderWidth="3px" CellPadding="4" GridLines="Horizontal"
Height="73px" AutoGenerateEditButton="True" OnRowEditing="dgvSortKey_RowEditing"
OnRowUpdating="dgvSortKey_RowUpdating" OnRowCancelingEdit="dgvSortKey_RowCancelingEdit"
OnSelectedIndexChanging="dgvSortKey_SelectedIndexChanging" OnPageIndexChanged="dgvSortKey_PageIndexChanged"
OnPageIndexChanging="dgvSortKey_PageIndexChanging" OnRowCommand="dgvSortKey_RowCommand"
OnRowDeleted="dgvSortKey_RowDeleted" OnRowUpdated="dgvSortKey_RowUpdated" Width="561px"
PageSize="15" DataKeyNames="KeyCode,KeyDescription">
<FooterStyle BackColor="White" ForeColor="#333333" />
<RowStyle BackColor="White" ForeColor="#333333" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="LightCyan" />
<Columns>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="lnkdelete" runat="server" OnClick="lnkdelete_Click">Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Instruction Key Code">
<ItemTemplate>
<asp:Label ID="lblValKeyCode" runat="server" Text='<%# Server.HtmlEncode((string)Eval("KeyCode")) %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtValKeyCode" runat="server" Text='<%#Bind("KeyCode") %>' MaxLength="10"></asp:TextBox>
<%--<asp:TextBox ID="txtValKeyCode" runat="server" Text='<%#System.Web.HttpUtility.HtmlEncode(Eval("KeyCode").ToString()) %>' MaxLength="10"></asp:TextBox>--%>
</EditItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" CssClass="GvBorderGreen" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="lblValKeyDescription" runat="server" Text='<%# Server.HtmlEncode((string)Eval("KeyDescription")) %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtValKeyDescription" runat="server" Text='<%#Bind("KeyDescription") %>'
MaxLength="10"></asp:TextBox>
<%--<asp:TextBox ID="txtValKeyDescription" runat="server" Text='<%#System.Web.HttpUtility.HtmlEncode(Eval("KeyDescription").ToString()) %>'
Width="300" MaxLength="20"></asp:TextBox>--%>
</EditItemTemplate>
<ItemStyle CssClass="GvBorderGreen" />
</asp:TemplateField>
<%--<asp:BoundField DataField="KeyCode" HeaderText="Instruction Key Code" HtmlEncode="true" />
<asp:BoundField DataField="KeyDescription" HeaderText="Description" HtmlEncode="true" />--%>
</Columns>
</asp:GridView>
</div>
Please help me to solve this problem.
As Waqar suggests the answer is in the link he provided - to make this more clear you need to change this line:
<asp:TextBox ID="txtValKeyCode" runat="server" Text='<%#Bind("KeyCode") %>' MaxLength="10"></asp:TextBox>
To this:
<asp:TextBox ID="txtValKeyCode" runat="server" Text='<%#System.Web.HttpUtility.HtmlEncode((string)Eval("KeyCode")) %>' MaxLength="10"></asp:TextBox>
I have a grid to update the employee's confirmation. I need to change the data from grid using edit and delete link. I have trouble to create this grid. Because gridview all textbox enable always.Textbox only enable when am click the edit button.
This is my partial code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
Width="100%" AutoGenerateColumns="False" CssClass="GridViewStyle" GridLines="None"
ShowHeaderWhenEmpty="True" EmptyDataText="No Data Found"
onpageindexchanging="GridView1_PageIndexChanging"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
onrowcancelingedit="GridView1_RowCancelingEdit"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating" >
<Columns>
<asp:TemplateField HeaderText="EMP ID">
<ItemTemplate>
<asp:TextBox ID="lblempId" runat="server" Text='<%#Bind("fldemp_id") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EMPLOYEE NAME">
<ItemTemplate>
<asp:TextBox ID="lblusername" runat="server" Text='<%#Bind("fldempname") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="JOINDATE">
<ItemTemplate>
<asp:TextBox ID="lbljoin" runat="server" Text='<%#Bind("fldjoindate") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CONFIRMATION DATE">
<ItemTemplate>
<asp:TextBox ID="lblconfirm" runat="server" Text='<%#Bind("fldconfirmdate") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="STATUS">
<ItemTemplate>
<asp:TextBox ID="lblStatus" runat="server" Text='<%#Bind("fldstatus") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CONFIRMATION STATUS">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Eval("fldcon_status") %>' >
<asp:ListItem>Confirmed</asp:ListItem>
<asp:ListItem>Not-Confirmed</asp:ListItem>
<asp:ListItem>Extended</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderImageUrl="~/images/edit.png">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/edit.png" CommandName="edi"
CommandArgument='<%#Bind("fldemp_id") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderImageUrl="~/images/Delete.png">
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/Delete.png"
CommandName="del" CommandArgument='<%#Bind("fldemp_id") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" HorizontalAlign="Left" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>
If you're asking how to disable editing in the grid until someone hits an Edit button, simply set Enabled property to False on the grid until your button is pressed.