This is a migrated thread and some comments may be shown as answers.

Cell value not fetching in Edit mode...

4 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 17 Apr 2013, 09:35 AM
Hi,
     when my radgrid is in edit mode , On pressing a button in the particular row (not a Update or Cancel) I need to fetch a cell value . Also I need to disable the edit mode. Wat i am using is

Aspx.cs
------------

 

protected

 

void btn_Click(object sender, EventArgs e)

{

Button btn = (Button)sender;

GridDataItem item = (GridDataItem)btn.NamingContainer;

TableCell cell = (TableCell)item["Id"];

string ID = cell.Text;

Label lbStatus = (Label)item.FindControl("lblStatus");

string Status = lbStatus.Text;
:
:
}
using this code i can fetch the status (lblStatus) value but the id value i got is &nbsp. How can i fetch the correct value of the cell "Id" & disable the edit mode pls help with a code. Thanx in advance..


4 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Apr 2013, 10:51 AM
Hello,

<telerik:GridBoundColumn DataField="Id" UniqueName="Id" HeaderText="Id">
                    </telerik:GridBoundColumn>

protected void btn_Click(object sender, EventArgs e)
    {
        Button btn = (Button)sender;
        GridDataItem item = (GridDataItem)btn.NamingContainer;
         
        string ID = item["Id"].Text; // Id is column UniqueName
        Label lbStatus = (Label)item.FindControl("lblStatus");
        string Status = lbStatus.Text;
    }


Thanks,
Jayesh Goyani
0
Siva
Top achievements
Rank 1
answered on 17 Apr 2013, 11:08 AM
Hi
It is not workin , Actually I can fetch the Id value if the grid is not in edit mode . when it is in edit mode it returns &nbsp.. Also help with a code to disable the edit..
0
Shinu
Top achievements
Rank 2
answered on 17 Apr 2013, 11:15 AM
Hi,

Try teh following.
C#:
protected void btn_Click(object sender, EventArgs e)
{
        Button btn = (Button)sender;
        GridEditableItem item = (GridEditableItem)btn.NamingContainer;
  TextBox txt = (TextBox)item["Id"].Controls[0];
       
}

Thanks,
Shinu
0
Siva
Top achievements
Rank 1
answered on 18 Apr 2013, 07:08 AM
This too not working.. I got the O/p by changing the Boundcolumn to template column since even in edit mode the Label value is fetching without error.. Thnx for ur help...
Tags
Grid
Asked by
Siva
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Siva
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or