TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dhoni kholi
NA
198
42.4k
How to get Value from Gridview on Button Click
Feb 21 2020 2:03 AM
Good Afternoon all,
This my code
<asp:GridView ID=
"GridView1"
runat=
"server"
AutoGenerateColumns=
"False"
DataKeyNames=
"Billno"
CssClass=
"Grid"
BackColor=
"White"
BorderColor=
"#CCCCCC"
BorderStyle=
"None"
BorderWidth=
"1px"
CellPadding=
"3"
AllowPaging=
"True"
ShowHeaderWhenEmpty=
"True"
onpageindexchanging=
"GridView1_PageIndexChanging"
Width=
"900px"
>
<Columns>
<asp:TemplateField HeaderText =
"Sl No."
>
<ItemTemplate>
<asp:Label ID=
"lblRowNumber"
Text=
'<%# Container.DataItemIndex + 1 %>'
runat=
"server"
/>
ItemTemplate>
asp:TemplateField>
<asp:BoundField DataField=
"Empid"
HeaderText=
"Emp Id"
/>
<asp:BoundField DataField=
"Billno"
HeaderText=
"Bill No"
/>
<asp:BoundField DataField=
"Bdate"
HeaderText=
"Bill Date"
/>
<asp:BoundField DataField=
"Amount"
HeaderText=
"Amount"
DataFormatString=
"{0:N2}"
/>
<asp:TemplateField HeaderText=
"Status"
>
<ItemTemplate>
<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>
<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>
ItemTemplate>
asp:TemplateField>
Columns>
<EmptyDataTemplate>No Record AvailableEmptyDataTemplate>
<FooterStyle BackColor=
"White"
ForeColor=
"#000066"
/>
<HeaderStyle BackColor=
"#006699"
Font-Bold=
"True"
ForeColor=
"White"
/>
<PagerSettings Mode=
"NumericFirstLast"
/>
<PagerStyle BackColor=
"#CCFFFF"
ForeColor=
"#000066"
HorizontalAlign=
"Center"
/>
<RowStyle ForeColor=
"#000066"
/>
<SelectedRowStyle BackColor=
"#669999"
Font-Bold=
"True"
ForeColor=
"White"
/>
<SortedAscendingCellStyle BackColor=
"#F1F1F1"
/>
<SortedAscendingHeaderStyle BackColor=
"#007DBB"
/>
<SortedDescendingCellStyle BackColor=
"#CAC9C9"
/>
<SortedDescendingHeaderStyle BackColor=
"#00547E"
/>
</asp:GridView>
when i click html button how to get the Billno from gridview
Please help me to how to write code
Thanks all
Reply
Answers (
5
)
clear session on leaving page confirmation alert message mvc
ASP.Net Gridview Mouse Over