Getting Data from selected row in gridview
Hi,
My issue is related to getting data in gridview when I selected a row. Because Always the value comes "".
Firstly I bind the dataset to gridview in code-behind. I didn't use sqldatasource. and in html code about gridview is below:
<asp:GridView ID="grd_getdata" runat="server" OnSelectedIndexChanged="grd_getdata_SelectedIndexC hanged"
AutoGenerateColumns="False" DataKeyNames="No" EnableSortingAndPagingCallbacks="True">
<Columns>
<asp:BoundField DataField="No" HeaderText="No" ReadOnly="True" />
</Columns>
</asp:GridView>
and selectedindexchangedevent code is;
protected void grd_getdata_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = grd_getdata.SelectedRow;
Session["aksesuar"] = row.Cells[0].Text;
}
So the value of row.Cells[0].Text always comes empty. On the other hand I see the value on gridview. Why couldn't I get the value?
I hope you know the answer!!!
|