asp gridview button another command

I have a Gridview based on a Acces DB in .aspx

I added +1 column to the grid, which is:

<asp:TemplateField HeaderText="view">
 <ItemTemplate>
      <asp:LinkButton runat="server" Text="Select" CommandName="Select" CausesValidation="False" id="Button1"></asp:LinkButton>
 </ItemTemplate>
</asp:TemplateField>    

I have a button outside of the grid: Button2

Could I add a command to Button1, to simulate to click on Button2 as well? Thank you, regards.

Upvotes: 0

Views: 26

Answers (1)

renakre
renakre

Reputation: 8291

Did I get you correctly:

void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
{

   if(e.CommandName=="Select")
   {
       MyFunction();
   }
}

void Button2_Click(Object sender, EventArgs e)
{
    MyFunction();
}

void MyFunction(){
   //your code
}

Upvotes: 1

Related Questions