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

Disabling textbox in Insert Mode.

4 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Swapna M
Top achievements
Rank 1
Swapna M asked on 23 Apr 2010, 01:14 PM
Hi,
    I am using Radgrid with GridTemplateColumn which is a textbox.
My requirement is when I enter Insert mode, i want to make all the textboxes in the grid readonly.
Please let me know how to do this?

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Apr 2010, 05:20 PM
Hello Swapna,

You can use this approach (C# code):
<telerik:GridTemplateColumn>
    .....
    <EditItemTemplate>
        <asp:TextBox ID="TextBox1"
             runat="server"
             Enabled='<%# !(Container is IGridInsertItem)  %>'
             Text="Test" />
    </EditItemTemplate>
</telerik:GridTemplateColumn>

I hope this helps.

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Swapna M
Top achievements
Rank 1
answered on 28 Apr 2010, 06:16 AM
Hi Daniel,
    Thanks for your reply.

    My requirement is textboxes in the grid should get disabled not the one in Insert Mode.
Please refer the attached image for clear understanding.
0
Daniel
Telerik team
answered on 30 Apr 2010, 09:51 PM
Hello Swapna,

Thank you for the clarification.

This requires a little modification to the code-snippet:
<telerik:GridTemplateColumn>
    .....
    <EditItemTemplate>
        <asp:TextBox ID="TextBox1"
             runat="server"
             Enabled='<%# !(Container as GridItem).OwnerTableView.IsItemInserted  %>'
             Text="Test" />
    </EditItemTemplate>
</telerik:GridTemplateColumn>


Kind regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Swapna M
Top achievements
Rank 1
answered on 03 May 2010, 07:41 AM
Thanks Daniel. It worked. :)
Tags
Grid
Asked by
Swapna M
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Swapna M
Top achievements
Rank 1
Share this question
or