S
stephen
Hi all,
If i have a gridview and have 3 columns of which i want to display only 2 as
one of them is "ID". why cant i access the ID value on the "RowUpdating"
event?
for eg:
<asp:GridView ID="gv_Sample" runat="server"
OnRowCancelingEdit="gv_Sample_RowCancelingEdit"
OnRowDataBound="gv_Sample_RowDataBound"
OnRowEditing="gv_Sample_RowEditing"
OnRowUpdating="gv_Sample_RowUpdating"
OnRowCommand="gv_Sample_RowCommand"
OnRowDeleting="gv_Sample_RowDeleting">
.....
<Columns>
<asp:BoundField DataField="ID" HeaderStyle-CssClass="hidden"
ItemStyle-CssClass="hidden" ReadOnly="true" />
<asp:TemplateField HeaderText="SiteName">
<ItemTemplate>
<asp:Label ID="lbl_SiteName" runat="server" Text='<%# Eval("SiteName")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SiteLocation">
<ItemTemplate>
<asp:Label ID="lbl_SiteLocation" runat="server" Text='<%#
Eval("SiteLocation") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lnk_Update" runat="server" CausesValidation="True"
CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="lnk_Delete" runat="server" CausesValidation="False"
CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton runat="server" ID="btn_Edit"
ImageUrl="~/Images/icon_miniinfo.gif"
CommandName="Edit" CausesValidation="False"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
On
protected void gv_Sample_RowUpdating(object sender, GridViewUpdateEventArgs
e)
{
.... I cant get the "ID" value from the BoundColumn...
}
Couple of question?
1. On Edit what does the "ID" Bound column convert itself? I understand that
in EditItemTemplate, the columns are converted to the respective controls
2. How can i get the values of the Hidden control?
Thanks and apprciate your help
Stephen
If i have a gridview and have 3 columns of which i want to display only 2 as
one of them is "ID". why cant i access the ID value on the "RowUpdating"
event?
for eg:
<asp:GridView ID="gv_Sample" runat="server"
OnRowCancelingEdit="gv_Sample_RowCancelingEdit"
OnRowDataBound="gv_Sample_RowDataBound"
OnRowEditing="gv_Sample_RowEditing"
OnRowUpdating="gv_Sample_RowUpdating"
OnRowCommand="gv_Sample_RowCommand"
OnRowDeleting="gv_Sample_RowDeleting">
.....
<Columns>
<asp:BoundField DataField="ID" HeaderStyle-CssClass="hidden"
ItemStyle-CssClass="hidden" ReadOnly="true" />
<asp:TemplateField HeaderText="SiteName">
<ItemTemplate>
<asp:Label ID="lbl_SiteName" runat="server" Text='<%# Eval("SiteName")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SiteLocation">
<ItemTemplate>
<asp:Label ID="lbl_SiteLocation" runat="server" Text='<%#
Eval("SiteLocation") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="" ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="lnk_Update" runat="server" CausesValidation="True"
CommandName="Update"
Text="Update"></asp:LinkButton>
<asp:LinkButton ID="lnk_Delete" runat="server" CausesValidation="False"
CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton runat="server" ID="btn_Edit"
ImageUrl="~/Images/icon_miniinfo.gif"
CommandName="Edit" CausesValidation="False"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
On
protected void gv_Sample_RowUpdating(object sender, GridViewUpdateEventArgs
e)
{
.... I cant get the "ID" value from the BoundColumn...
}
Couple of question?
1. On Edit what does the "ID" Bound column convert itself? I understand that
in EditItemTemplate, the columns are converted to the respective controls
2. How can i get the values of the Hidden control?
Thanks and apprciate your help
Stephen