MartinChadderton
asked on
I have an edit button set up as a template field within a gridview and i want to edit that row if it is clicked but it is not firing the rowcomand event in the gridview.
aspx file:
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="edit" runat="server"
CommandName="EditMilestone s"
CommandArgument="<%# CType(Container,GridViewRo w).RowInde x %>"
Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
code behind file
Protected Sub GrdVisualObjectives_RowCom mand(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls. GridViewCo mmandEvent Args)
If (e.CommandName = "EditMilestones") Then
' Retrieve the row index stored in the CommandArgument property.
Dim index As Integer = Convert.ToInt32(e.CommandA rgument)
' Retrieve the row that contains the button
' from the Rows collection.
Dim row As GridViewRow = GrdVisualObjectives.Rows(i ndex)
' Add code here to add the item to the shopping cart.
End If
End Sub
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="edit" runat="server"
CommandName="EditMilestone
CommandArgument="<%# CType(Container,GridViewRo
Text="Edit" />
</ItemTemplate>
</asp:TemplateField>
code behind file
Protected Sub GrdVisualObjectives_RowCom
ByVal e As System.Web.UI.WebControls.
If (e.CommandName = "EditMilestones") Then
' Retrieve the row index stored in the CommandArgument property.
Dim index As Integer = Convert.ToInt32(e.CommandA
' Retrieve the row that contains the button
' from the Rows collection.
Dim row As GridViewRow = GrdVisualObjectives.Rows(i
' Add code here to add the item to the shopping cart.
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER