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

[Solved] GridEditCommandColumn and EditText

2 Answers 229 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Daniel asked on 18 Nov 2009, 11:43 PM
Hi All. Is it possible to change the EditText on a GridEditCommandColumn to a different value for each row? For example, I'd like to enter edit mode by click on a persons name. I'm doing all this in the code behind (C#). I can set the 'text' property but then I loose the link button. Thanks.

Daniel

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 19 Nov 2009, 04:24 AM
Hello Daniel,

Tryout the following code snippet in order to change the Edit text from code behind.

CS:
 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            LinkButton lnkButton = (LinkButton)item["EditColumn"].Controls[0]; //EditColumn is columnuniquename of EditCommandColumn 
            // Set the edit text as required 
            lnkButton.Text = item.GetDataKeyValue("Name").ToString(); // Where I set the DataKeyNames as 'Name' in MasterTableView 
        }              
    } 

Regards,
Shinu.
0
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Nov 2009, 04:53 AM
Thanks Shinu, that helped me out.

Daniel
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Shinu
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or