Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

EditItemTemplate column not displaying on first EditCommand click

 
 
DM
Guest
Posts: n/a
 
      01-10-2004
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.EditCommand
dgCat1.EditItemIndex = e.Item.ItemIndex
End Sub

Sub dgCat1_Cancel(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
dgCat1.CancelCommand
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
dgCat1.UpdateCommand
'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>
<Columns>
<asp:BoundColumn Visible="False" DataField="ID" ReadOnly="True"
HeaderText="ID"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button runat="server" Text="Edit" CommandName="Edit"
CausesValidation="false"></asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:Button runat="server" Text="Save"
CommandName="Update"></asp:Button>&nbsp;
<asp:Button runat="server" Text="Cancel" CommandName="Cancel"
CausesValidation="false"></asp:Button>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Priority">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.Priority") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container,
"DataItem.Priority") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="CATEG_NBR_SUB" ReadOnly="True"
HeaderText="NBR">
<HeaderStyle Width="50px"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CATEG_DESC" ReadOnly="True"
HeaderText="Category">
<HeaderStyle Width="150px"></HeaderStyle>
</asp:BoundColumn>
</Columns>
</asp:datagrid>



 
Reply With Quote
 
 
 
Reply

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



Advertisments