Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
please provide me one example...

i have two buttons "Approve" and "Reject". on clicking on these buttons .... i want to change the value in the database accordingly....

thankyou
Posted
Comments
kishore sharma 16-Feb-12 0:37am    
Hello,
just go to design and edit tempate thr u can select column(select button column)
and now u can see that button .u can click on that button and you will get that methode in code behind.
Happy Coding

1 solution

Add CommandName for each button in the gridview and

use grdCardWallet_RowCommand to do your operation as required.

XML
<asp:TemplateField ItemStyle-VerticalAlign="Middle">
                              <ItemTemplate>
                                  <asp:LinkButton ID="lnkApprove"
                                      Text="Approve" CommandArgument='<%# Eval("Approve") %>' CommandName="Arrpove"
                                       runat="server"></asp:LinkButton>
                                  <div class="ht4">
                                  </div>
                                  <asp:LinkButton ID="lnkReject" CommandName="Reject" CommandArgument='<%# Eval("Reject") %>'
                                      Text="Reject"  runat="server"></asp:LinkButton>
                              </ItemTemplate>
                          </asp:TemplateField>



use the below codebehind for your action

C#
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
   {

           if (e.CommandName == "Aprove")
           {

           }
           if (e.CommandName == "reject")
           {

           }
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900