I have my grid in edit mode for all rows all the time and I need to
place onblur and onfocus javascript client side events to each
individual radcombobox that is generated in edit mode in this grid but I
don't seem to be able to figure out how to attach these events to the
right control
it looks like from the markup that the
i saw this article that talks about how to attach onblur event to a combobox but it seems to refer to an older non-ajax version - I'm using the latest 2010 telerik ajax version
'
aspx
code behind
it looks like from the markup that the
dataItem["attendancekind"].Controls[0].ClientID + "_Input' is the clientid of the combobox |
i saw this article that talks about how to attach onblur event to a combobox but it seems to refer to an older non-ajax version - I'm using the latest 2010 telerik ajax version
'
aspx
<telerik:RadGrid ID="MyRadGrid" runat="server" AutoGenerateColumns="False" |
Width="300px" DataSourceID="MyObjectDataSource" AllowAutomaticDeletes="True" |
AllowAutomaticInserts="True" AllowAutomaticUpdates="True" GridLines="None" AllowMultiRowEdit="True" |
OnPreRender="MyRadGrid_PreRender"> |
<ClientSettings EnablePostBackOnRowClick="True"> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
<MasterTableView DataKeyNames="myid" DataSourceID="MyObjectDataSource" |
EditMode="InPlace" InsertItemPageIndexAction="ShowItemOnCurrentPage"> |
<Columns> |
<telerik:GridBoundColumn DataField="myid" Display="False" UniqueName="myid"> |
</telerik:GridBoundColumn> |
<telerik:GridDropDownColumn DataField="anotherid" DataSourceID="PersonObjectDataSource" |
HeaderText="Name" ListTextField="name" ListValueField="anotherid" DataType="System.Guid" |
UniqueName="anotherid"> |
</telerik:GridDropDownColumn> |
<telerik:GridDropDownColumn DataField="attendancekind" DataSourceID="MyKindObjectDataSource" |
HeaderText="" ListTextField="description" ListValueField="attendancekind" |
DataType="System.Guid" UniqueName="attendancekind"> |
</telerik:GridDropDownColumn> |
<telerik:GridClientSelectColumn Display="False" UniqueName="column"> |
</telerik:GridClientSelectColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
code behind
protected void MyRadGrid_PreRender(object sender, EventArgs e) |
{ |
// put all items in edit mode by default |
for (int i = 0; i < MyRadGrid.PageSize; i++) |
{ |
MyRadGrid.EditIndexes.Add(i); |
} |
MyRadGrid.Rebind(); |
//subtotal |
foreach (GridDataItem dataItem in MyRadGrid.MasterTableView.Items) |
{ |
(dataItem["attendancekind"].Controls[0] as RadComboBox).Attributes.Add( |
"onblur", "update(''" + dataItem["attendancekind"].Controls[0].ClientID + "_Input');"); |
(dataItem["attendancekind"].Controls[0] as RadComboBox).Attributes.Add( |
"onfocus", "getInitialValue('" + dataItem["attendancekind"].Controls[0].ClientID + "_Input');"); |
} |
} |