N
news.microsoft.com
I have been working some on a gridview to incorporate the ability to edit
data for a row. I set up TemplateFields with EditItemTemplates to
incorporate the text box controls I want for editing, but I cannot get the
text box to render. I verified that the "RowEditing" event is firing
properly when my edit image button is clicked. Could you please scan my
markup below and let me know if you see anything wrong? I have read MSDN for
an hour along with google, and I can't see anything that I am doing that
would cause the EditItemTemplate to be ignored...
thanks!
<asp:GridView ID="GridView_TestOrders" runat="server"
AutoGenerateColumns="False" CssClass="gv_maintable"
OnRowCreated="GridView_TestOrders_RowCreated"
OnRowDeleting="GridView_TestOrders_RowDeleting"
OnRowEditing="GridView_TestOrders_RowEditing"
OnRowCancelingEdit="GridView_TestOrders_RowCancelingEdit"
OnRowUpdating="GridView_TestOrders_RowUpdating">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton_Edit" CommandName="Edit"
runat="server" ImageUrl="images/CommentHS.png" />
<asp:ImageButton ID="ImageButton_Delete"
CommandName="Delete" runat="server" ImageUrl="images/rightsrestrictedhs.png"
/>
<asp:ImageButton ID="ImageButton_Update"
CommandName="Update" runat="server" ImageUrl="images/SaveHS.png" />
<asp:ImageButton ID="ImageButton_Cancel"
CommandName="Cancel" runat="server" ImageUrl="images/Edit_UndoRed.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="TEST#" DataField="TestNumber" />
<asp:BoundField HeaderText="TEST NAME" DataField="TestName" />
<asp:TemplateField HeaderText="COL">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "dataval") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox_DataEdit" runat="server" Text='<%#
Eval("dataval") %>' Width="55"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
data for a row. I set up TemplateFields with EditItemTemplates to
incorporate the text box controls I want for editing, but I cannot get the
text box to render. I verified that the "RowEditing" event is firing
properly when my edit image button is clicked. Could you please scan my
markup below and let me know if you see anything wrong? I have read MSDN for
an hour along with google, and I can't see anything that I am doing that
would cause the EditItemTemplate to be ignored...
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
<asp:GridView ID="GridView_TestOrders" runat="server"
AutoGenerateColumns="False" CssClass="gv_maintable"
OnRowCreated="GridView_TestOrders_RowCreated"
OnRowDeleting="GridView_TestOrders_RowDeleting"
OnRowEditing="GridView_TestOrders_RowEditing"
OnRowCancelingEdit="GridView_TestOrders_RowCancelingEdit"
OnRowUpdating="GridView_TestOrders_RowUpdating">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton_Edit" CommandName="Edit"
runat="server" ImageUrl="images/CommentHS.png" />
<asp:ImageButton ID="ImageButton_Delete"
CommandName="Delete" runat="server" ImageUrl="images/rightsrestrictedhs.png"
/>
<asp:ImageButton ID="ImageButton_Update"
CommandName="Update" runat="server" ImageUrl="images/SaveHS.png" />
<asp:ImageButton ID="ImageButton_Cancel"
CommandName="Cancel" runat="server" ImageUrl="images/Edit_UndoRed.png" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="TEST#" DataField="TestNumber" />
<asp:BoundField HeaderText="TEST NAME" DataField="TestName" />
<asp:TemplateField HeaderText="COL">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "dataval") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox_DataEdit" runat="server" Text='<%#
Eval("dataval") %>' Width="55"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>