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

e.cancelled causing read only field to become editable

3 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 11 Nov 2011, 02:29 PM
I have a small bit of validation that when fails cancels an update. When this happens, the fields that i want to stay in edit mode do so but one column that is explicity set to readonly becomes editable also. Is there any reason for this?

3 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 11 Nov 2011, 06:01 PM
Anyone? This e.cancel is causing some funny behaviours in both insert and update. On update, when validation fails and e,cancel is executed one of my read only columns (Griddropdowncolumn) holds no values after the e.cancel i.e. the grid stays in edit mode. I populate my read only (at runtime) drop down column on the item databaound like so:

if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            if (e.Item.DataItem != null && e.Item.DataItem is FixedMeanAndSD)
            {
                FixedMeanAndSD row = (FixedMeanAndSD)e.Item.DataItem;
                dataItem["LotNo"].Text = row.LotDetail.LotNumber;
            }
}

The column only becomes editible in insert mode, when the original problem i discussed above is encountered. When e.cancel is run it seems to do nothing afterwards i.e. hit any of my itemcommand, itemdatabound etc. code. Any help would be greatly appreciated.
0
Michael
Top achievements
Rank 1
answered on 15 Nov 2011, 10:18 AM
Is there anyone from Telerik who can assist me on this? It is holding me back and i would appreciate assistance.
0
Tsvetina
Telerik team
answered on 16 Nov 2011, 09:25 AM
Hi Michael,

It is expected that e.Canceled would not call any command after being called. As in other cancellable events, it only cancels the default operation. If you want to have a rebind or fire another command, you should do it manually.
Also, if you are manually making the column readonly in ItemDataBound, move your logic to ItemCreated, as it runs on each postback (while ItemDataBound runs only when the grid is rebound).

If none of these helps, paste your code related to this issue and we will test it locally.

Greetings,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or