Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > EditItemTemplate column not displaying on first EditCommand click

Thread Tools

EditItemTemplate column not displaying on first EditCommand click

Posts: n/a
For some reason, when I click the edit template command button on my grid,
the edit command fires, but the edit template controls don't display. When
I click the Edit command again, the Update command fires but then the edit
template controls display. It appears that the rendering is a step behind
what is actually happening. What could I be doing wrong?

'Click 1 - this event fires but edit controls don't render
Sub dgCat1_Edit(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgCat1.EditItemIndex = e.Item.ItemIndex
End Sub

Sub dgCat1_Cancel(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgCat1.EditItemIndex = -1
End Sub

'Click 2 - this event fires, and the edit controls render
Sub dgCat1_Save(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
'Save record
Dim newTB As TextBox
dnewTBw =
dgCat1.Items(e.Item.ItemIndex).Cells(2).FindContro l("txtPriorityEdit")
Dim strNewVal As String = newTB.Text
'Call storedproc to act on user input


<asp:datagrid id="dgCat1" style="Z-INDEX: 105; LEFT: 14px;
POSITION: absolute; TOP: 3px" runat="server" Font-Names="Arial"
Width="339px" Font-Size="XX-Small" Height="5px" AutoGenerateColumns="False"
OnEditCommand="dgCat1_Edit" OnCancelCommand="dgcat1_Cancel"
OnUpdateCommand="dgCat1_Save" DataKeyField="ID">
<AlternatingItemStyle BackColor="#CCCCFF"></AlternatingItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="Arial" Font-Bold="True"
ForeColor="White" BackColor="Black"></HeaderStyle>
<asp:BoundColumn Visible="False" DataField="ID" ReadOnly="True"
<asp:Button runat="server" Text="Edit" CommandName="Edit"
<asp:Button runat="server" Text="Save"
<asp:Button runat="server" Text="Cancel" CommandName="Cancel"
<asp:TemplateColumn HeaderText="Priority">
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.Priority") %>'>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.Priority") %>'>
<asp:BoundColumn DataField="CATEG_NBR_SUB" ReadOnly="True"
<HeaderStyle Width="50px"></HeaderStyle>
<asp:BoundColumn DataField="CATEG_DESC" ReadOnly="True"
<HeaderStyle Width="150px"></HeaderStyle>

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
EditItemTemplate not showing on first click Jim in Arizona ASP .Net 0 10-11-2006 08:53 PM
Sortable column on DataGrid -- column header not displaying Teej ASP .Net Datagrid Control 2 08-15-2006 06:23 PM
DataList EditCommand displaying Different EditItemTemplates =?Utf-8?B?V2ViTWF0cml4?= ASP .Net 0 03-14-2006 10:37 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM
controlling size of editcommand column in edit mode Nedu N ASP .Net Datagrid Control 3 08-24-2003 12:39 PM