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

Acessing the controls in RadEditform

1 Answer 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rajesh
Top achievements
Rank 1
rajesh asked on 28 Dec 2011, 06:59 AM
Hi sir
i want to acess the controls from client side in edit form when i click  add new button or clicking  edit...for example i want to acess machinery or material  combobox shown in...attached image file...


Thanks and regards
Rajesh

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 28 Dec 2011, 08:22 AM
Hello,

One option you can do is save the ClientID of the control in a HiddenField and access it from client side. Sample code is given below.
CS:
protected void grid1_ItemCreated(object sender, GridItemEventArgs e)
{
 if (e.Item.IsInEditMode && e.Item is GridEditableItem)
  {
     GridEditableItem editModeRow = null;
     editModeRow = (GridEditableItem)e.Item;
     TextBox grdtxtbx = (TextBox)editModeRow["ColUniqueName"].Controls[0];
     HiddenField1.Value = grdtxtbx.ClientID;
   }
}
JS:
<script type="text/javascript">
 function OnClientClick()
   {
     var grdtxtbx = document.getElementById('HiddenField1');
     var temp = grdtxtbx .value;
     alert(document.getElementById(temp).value);
   }
</script>

Thanks,
Princy.
Tags
Grid
Asked by
rajesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or