I'm using radgrid for PopUp editing mode
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?
This is my aspx code:
<
MasterTableView EditMode="PopUp" CommandItemDisplay="Top" DataKeyNames="Customer _ID" DataSourceID="sdsCustomer" Width="100%">
<Columns>
<
telerik:GridTemplateColumn DataField="Customer_ID" Visible="false" HeaderText="Customer ID"
SortExpression="Customer_ID" UniqueName="Customer_ID">
<ItemTemplate>
<asp:Label ID="Customer_IDLabel" runat="server" Text='<%# Eval("Customer_ID") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Customer_IDTextBox" Width="200px" runat="server"
Text='<%# Bind("Customer_ID") %>'></asp:TextBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn DataField="Customer_Name" HeaderText="Name"
SortExpression="Customer_Name" ItemStyle-Wrap="false" UniqueName="Customer_Name">
<EditItemTemplate>
<asp:TextBox ID="Customer_NameTextBox" Width="200px" runat="server"
Text='<%# Bind("Customer_Name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Customer_NameLabel" runat="server"
Text='<%# Eval("Customer_Name") %>'></asp:Label>
</ItemTemplate>
<
ItemStyle Wrap="False"></ItemStyle>
</telerik:GridTemplateColumn>
</
Columns>
I am using this code:
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then
Dim edititem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim txtbx As TextBox = DirectCast(edititem("Customer_ID").Controls(0), TextBox)
txtbx.Enabled =
False
End If
End Sub
But it don't seems to work. Thanks