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

Rendering javascript

1 Answer 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 19 Mar 2009, 01:42 AM
I want to render some Javascript using ScriptManager.RegisterClientScriptBlock() whenever there's a edit form visible. I also need the Client IDs of the controls in the edit form. Right now I can look for RadGrid.EditItems.Count > 0 inside OnPreRender() to determine when the grid is in edit mode, and then use that to fetch all the controls using FindControl().

But this doesn't work in Insert mode. RadGrid.EditItems is empty. What's the propery way to do what I want to do?

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 23 Mar 2009, 01:16 PM
Hi Brad,

In insert mode, you can check if there is a new item being added (RadGrid1.MasterTableView.IsItemInserted). Then, if the control is in insert mode, you can get the insert for (RadGrid1.MasterTableView.GetInsertItem()), and reference the controls in it.
I hope this helps.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Brad
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or