Hey,
I know I've seen this around before but I forgot how to do it... I have a couple buttons within a Gridview's Itemtemplate. I need to assign the commandargument to the buttons and not sure exactly how to do it...
I've been messing around in the RowCreated event and just in the markup
Code:<asp:Button ID="btnDetails" runat="server" CommandName="Details" CommandArgument='<%# notsurewhattoputhere %>' Text="Details" Width="80px" /><br />Code:Protected Sub gvItemGrid_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvItemGrid.RowCreated If e.Row.RowIndex > 0 Then Dim btnDetails As Button = DirectCast(e.Row.Cells(5).FindControl("btnDetails"), Button) btnDetails.CommandArgument = e.Row.RowIndex.ToString End If End Sub




Reply With Quote