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

What does this code do (it was in the samples)

3 Answers 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
matt
Top achievements
Rank 1
matt asked on 16 Sep 2010, 05:21 PM
My program seems to work fine without it but I am nervous about removing it.

 protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            if (!e.Item.OwnerTableView.IsItemInserted)
            {
                GridEditableItem item = e.Item as GridEditableItem;

                GridEditManager manager = item.EditManager;

                GridTextBoxColumnEditor editor = manager.GetColumnEditor("CustomerID") as GridTextBoxColumnEditor;

                editor.TextBoxControl.Enabled = false;
            }

        }
    }

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Sep 2010, 05:38 AM
Hi matt,

The code disables(Enabled = false) TextBox control for specified column(manager.GetColumnEditor("CustomerID")) if the current item is in edit mode and not in insert mode(i.e. inserting new item).
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            if (!e.Item.OwnerTableView.IsItemInserted)


Nikolay
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
matt
Top achievements
Rank 1
answered on 17 Sep 2010, 02:16 PM
ok.. so if I am hiding the primary key column (OrgID) then this line is not needed right?

0
Nikolay Rusev
Telerik team
answered on 23 Sep 2010, 07:19 AM
Hi matt,

No, hiding column will not result in not visible in edit mode. To set that column is not editable you should set ReadOnly="true".

Regards,
Nikolay
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
Tags
Grid
Asked by
matt
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
matt
Top achievements
Rank 1
Share this question
or