I have a grid using the Batch edit mode. I have a need to use a multi-select ListBox as the editor for a particular column and to bind it using data from the server (in code-behind, not a front-end SQLDataSource, etc) and then pre-select items if they match information coming from the database. How? In previous grids, I could use ItemDataBound to preload the ListBox. However, batch mode was a lot of work building client side code to handle multiple edits. I'm wanting to use your new batch mode, but...
I have tried to read/understand and follow the information here and here.
I have tried all manner of the following in the PreRender method, but cannot get a hold of the listbox...
How do I go about getting a hold of the ListBox, populate it from code-behind, and select the items in it based on values from the database? Is this possible?
I have tried to read/understand and follow the information here and here.
I have tried all manner of the following in the PreRender method, but cannot get a hold of the listbox...
<
telerik:GridTemplateColumn
DataField
=
"MyDataField"
HeaderText
=
"My Header"
UniqueName
=
"MyUniqueName"
>
<
ItemTemplate
>
<%# Eval("MyBoundItem") %>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadListBox
ID
=
"MyRadListBox"
runat
=
"server"
SelectionMode
=
"Multiple"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
GridTableView masterTable = (sender as RadGrid).MasterTableView;
RadListBox myRadListBox = masterTable.GetBatchColumnEditor("MyRadListBox") as RadListBox; // Suspicious Bind & null being returned
myRadListBox.DataSource = myDataSource;
myRadListBox.DataBind();
How do I go about getting a hold of the ListBox, populate it from code-behind, and select the items in it based on values from the database? Is this possible?