T
tester
I have two command buttons in my gridview, both the same because I want to
launch the rowedit command. But one is a Copy function that will launch the
edit command but when the user hits update will grab the flag and insert a
new record instead of update the selected one. In the row command event,
all properties seem to have the same value, the commandname for both buttons
are "Edit", and there's no way in the command button itself to set the
CommandName, how do I distinguish between the two buttons. One says copy
and one says edit but there doesn't seem to be a way to grab that
information.
<asp:CommandField ShowEditButton="True" >
<HeaderStyle BorderColor="White" BorderStyle="None"
Font-Underline="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:CommandField>
<asp:CommandField ShowEditButton="True" EditText="Copy">
<HeaderStyle BorderColor="White" BorderStyle="None"
Font-Underline="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:CommandField>
Protected Sub Gridview_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs)
If e.CommandName = "Copy" Then
'set a flag here for copy mode End If
End Sub
launch the rowedit command. But one is a Copy function that will launch the
edit command but when the user hits update will grab the flag and insert a
new record instead of update the selected one. In the row command event,
all properties seem to have the same value, the commandname for both buttons
are "Edit", and there's no way in the command button itself to set the
CommandName, how do I distinguish between the two buttons. One says copy
and one says edit but there doesn't seem to be a way to grab that
information.
<asp:CommandField ShowEditButton="True" >
<HeaderStyle BorderColor="White" BorderStyle="None"
Font-Underline="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:CommandField>
<asp:CommandField ShowEditButton="True" EditText="Copy">
<HeaderStyle BorderColor="White" BorderStyle="None"
Font-Underline="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
</asp:CommandField>
Protected Sub Gridview_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs)
If e.CommandName = "Copy" Then
'set a flag here for copy mode End If
End Sub