dhoni kholi

dhoni kholi

  • 1.7k
  • 193
  • 4.6k

How to get Value from Gridview on Button Click

Feb 21 2020 2:03 AM
Good Afternoon all,
 
This my code
  1. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"  
  2. DataKeyNames="Billno" CssClass="Grid" BackColor="White" BorderColor="#CCCCCC"  
  3. BorderStyle="None" BorderWidth="1px" CellPadding="3" AllowPaging="True" ShowHeaderWhenEmpty="True"  
  4. onpageindexchanging="GridView1_PageIndexChanging" Width="900px" >  
  5. <Columns>  
  6. <asp:TemplateField HeaderText = "Sl No.">  
  7. <ItemTemplate>  
  8. <asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />  
  9. ItemTemplate>  
  10. asp:TemplateField>  
  11. <asp:BoundField DataField="Empid" HeaderText="Emp Id" />  
  12. <asp:BoundField DataField="Billno" HeaderText="Bill No" />  
  13. <asp:BoundField DataField="Bdate" HeaderText="Bill Date" />  
  14. <asp:BoundField DataField="Amount" HeaderText="Amount" DataFormatString="{0:N2}" />  
  15. <asp:TemplateField HeaderText="Status">  
  16. <ItemTemplate>  
  17. <button id="btnNot" class="btn-danger" runat="server" title="Not paid" Visible='<%# Convert.ToInt32(Eval("Status")) == 1 ? true : false %>' causesvalidation="False"> <span class="fa fa-times " style="font-size: inherit;" >span> <%# Eval("Status").ToString() == "True" ? "Not Paid" : "Paid" %> button>  
  18. <button id="btnpay" class="btn-success" runat="server" title="paid" Visible='<%# Convert.ToInt32(Eval("Status")) == 1 ? false : true %>' causesvalidation="False"> <span class="fa fa-check " style="font-size: inherit;" >span> <%# Eval("Status").ToString() == "False" ? "Paid" : "Not Paid"%> button>  
  19. ItemTemplate>  
  20. asp:TemplateField>  
  21. Columns>  
  22. <EmptyDataTemplate>No Record AvailableEmptyDataTemplate>  
  23. <FooterStyle BackColor="White" ForeColor="#000066" />  
  24. <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />  
  25. <PagerSettings Mode="NumericFirstLast" />  
  26. <PagerStyle BackColor="#CCFFFF" ForeColor="#000066" HorizontalAlign="Center" />  
  27. <RowStyle ForeColor="#000066" />  
  28. <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />  
  29. <SortedAscendingCellStyle BackColor="#F1F1F1" />  
  30. <SortedAscendingHeaderStyle BackColor="#007DBB" />  
  31. <SortedDescendingCellStyle BackColor="#CAC9C9" />  
  32. <SortedDescendingHeaderStyle BackColor="#00547E" />  
  33. </asp:GridView>  
when i click html button how to get the Billno from gridview
 
Please help me to how to write code
 
Thanks all

Answers (5)