I have a GridView with Asp:button like below:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="CourseId">
<Columns>
<asp:BoundField DataField="SubjectStudyId" HeaderText="SubjectStudyId" SortExpression="SubjectStudyId" />
<asp:BoundField DataField="LessonTitle" HeaderText="LessonTitle" SortExpression="LessonTitle" />
<asp:BoundField DataField="ExamDate" HeaderText="ExamDate" SortExpression="ExamDate" />
<asp:BoundField DataField="ExamTime" HeaderText="ExamTime" SortExpression="ExamTime" />
<asp:BoundField DataField="RoomId" HeaderText="RoomId" SortExpression="RoomId" />
<asp:BoundField DataField="RoomTitle" HeaderText="RoomTitle" SortExpression="RoomTitle" />
<asp:TemplateField>
<ItemTemplate>
<asp:Button Text="Get Value" runat="server" OnClick="GridView_Button_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Now I want to get the value of LessonTitle field.
for example when I use:
<asp:CommandField SelectText="select" ShowSelectButton="True" />
I could get the ٰValue of each field that I want like below:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView2.SelectedRow;
LblCode.Text = row.Cells[1].Text;
}
how can I get the value of GridView when we have Asp:button in it?