Edit & Copy buttons in gridview

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top