Arif YILMAZ
Arif YILMAZ

Reputation: 5866

how to get selected row from DevExp AspxGridview

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)
        { }
    }

enter image description here

Upvotes: 0

Views: 2525

Answers (1)

TrevorBrooks
TrevorBrooks

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

Related Questions