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

Rad Grid Edit

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kollam2003
Top achievements
Rank 1
kollam2003 asked on 24 Mar 2009, 05:13 AM
Hai,
I'm using radgrid for inline editing
I have two template columns.
In the "Insert" mode i want to enable the two text boxes.
But in edit - update mode i want to disable the first text box.
How can we achieve this?
Plz help.

Kollam 2003

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 24 Mar 2009, 07:01 AM

Hi,

Try the following code snippets for disabling the textbox when in EditMode.

ASPX:

<telerik:GridTemplateColumn UniqueName="TempCol1">  
<ItemTemplate> 
    . . .  
</ItemTemplate> 
<EditItemTemplate> 
    <asp:TextBox ID="TextBox1" Text="Text1" runat="server"></asp:TextBox> 
</EditItemTemplate> 
</telerik:GridTemplateColumn> 
<telerik:GridTemplateColumn UniqueName="TempCol2">  
<ItemTemplate>     
  . . .  
</ItemTemplate> 
<EditItemTemplate> 
<asp:TextBox ID="TextBox2" Text="Text2" runat="server"></asp:TextBox> 
</EditItemTemplate> 
</telerik:GridTemplateColumn> 

CS:

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
{  
    if (e.Item is GridEditableItem && e.Item.IsInEditMode && !e.Item.OwnerTableView.IsItemInserted)  
    {  
        GridEditableItem editItem = e.Item as GridEditableItem;  
        TextBox textbox1 = (TextBox)editItem["TempCol1"].FindControl("TextBox1");  
        textbox1.Enabled = false;  
    }      

Thanks,
Princy.
Tags
Grid
Asked by
kollam2003
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or