Hi,
I am using grid with FormTemplate popup for edit or update row and i need to access the FormTemplate controls from javascript code.
I found a way to do that using he forums and documetations and it is working good. the problem is when i add update panel to my page in order to avoid postbacks, i get nulls while accessing my controls on javascript.
This is how i implement finding the controls:
in the code behind:
and on javascript:
When the SetRoleVisibility is fired cmbRoles should hold the RadComboBox. it does when not using update panel, but once i use one, the $find method returns null.
Can you please advice?
Thanks,
Ruth
I am using grid with FormTemplate popup for edit or update row and i need to access the FormTemplate controls from javascript code.
I found a way to do that using he forums and documetations and it is working good. the problem is when i add update panel to my page in order to avoid postbacks, i get nulls while accessing my controls on javascript.
This is how i implement finding the controls:
in the code behind:
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditFormItem && e.Item.IsInEditMode) |
| { |
| GridEditFormItem editFormItem = (GridEditFormItem) e.Item; |
| RadComboBox cmbRoles = editFormItem.FindControl("RoleCombo") as RadComboBox; |
| if (cmbRoles != null) |
| { |
| usersGrid.Controls.Add( |
| new LiteralControl("<script type='text/javascript'>window['RolesComboId'] = '" + |
| cmbRoles.ClientID + |
| "';</script>")); |
| } |
| } |
and on javascript:
| function SetRoleVisibility(item) { |
| var cmbRoles = $find(window['RolesComboId']); |
| } |
When the SetRoleVisibility is fired cmbRoles should hold the RadComboBox. it does when not using update panel, but once i use one, the $find method returns null.
Can you please advice?
Thanks,
Ruth