Reputation: 5866
I am trying to get the selected row from the aspxgridview when the user clicks the "SEÇ"("SELECT") button on screen as shown below.
when the user click the SEC button, it gives null reference exception
What am doing wrong?
here is my code...
protected void btnClose0_Click(object sender, EventArgs e)
{
try
{
string cari_logref = gvCari.GetDataRow(gvCari.FocusedRowIndex)["LOGICALREF"].ToString();
dtneww = ListTable(Convert.ToInt16(cari_logref));
gv.DataSource = dtneww;
gv.DataBind();
}
catch (Exception)
{ }
}
Upvotes: 0
Views: 2525
Reputation: 3840
You are attempting to retrieve the focused row with FocusedRowIndex, what you want is GetSelectedFieldValues which is different, see: https://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_GetSelectedFieldValuestopic
Upvotes: 1