Hello.
I am creating a servercontrol that inherits the radgrid.
I am creating it on "OnLoad"
I want to create a GridDropDownColumn that will be filled by a DataSet.
From what i read i saw i have 3 options :
1) GridDropDownColumn with DataSourceID ,
2) DropDownColumn that can "bind" to the gridDataSource ( the gridatasource must have both id and text - and i can only have the id)
3) Template.
I can't use number 1 and 2. so the only option is template.
I created a class for ItemTemplate, and one for EditItemTemplate.
The problem i have is with the EditItemTemplate
I wanted to make it only ITemplate but i got an error saying i need to make it IBindableTemplate.
On ItemDataBound i find the template, get the dropdownlist and bind it to my DataSet.
When i push the "Edit" command it works. The problem appears when i push "Update".
On the "GridTelerik_UpdateCommand" event i need to Extract the new values.
But i get an error at : ((GridEditableItem)e.Item).ExtractValues(newValues);
The error is : "Editor cannot be initialized for column : <columnName> - where columnName is the uniqueName of the TemplateColumn.
Is there a way i can resolve it. Does it have a problem because i instantiate the column editItemTemplate on Load? In case there is a better solution for this situation please advice me.
Thanks.
I am creating a servercontrol that inherits the radgrid.
I am creating it on "OnLoad"
I want to create a GridDropDownColumn that will be filled by a DataSet.
From what i read i saw i have 3 options :
1) GridDropDownColumn with DataSourceID ,
2) DropDownColumn that can "bind" to the gridDataSource ( the gridatasource must have both id and text - and i can only have the id)
3) Template.
I can't use number 1 and 2. so the only option is template.
I created a class for ItemTemplate, and one for EditItemTemplate.
The problem i have is with the EditItemTemplate
class DropDownListTemplate : IBindableTemplate<br> {<br> string dataField = null;<br> bool enabled;<br> DropDownList ddl = null;<br><br> public DropDownListTemplate(string dataField, bool enabled)<br> {<br> this.dataField = dataField;<br> this.enabled = enabled;<br> }<br><br> void ITemplate.InstantiateIn(Control container)<br> {<br> ddl = new DropDownList();<br> ddl.Enabled = enabled;<br> ddl.DataBinding += ddl_DataBinding;<br> container.Controls.Add(ddl);<br> }<br><br> void ddl_DataBinding(object sender, EventArgs e)<br> {<br> ddl = (DropDownList)sender;<br> ddl.ID = dataField;<br> GridEditFormItem bidingContainer = ddl.NamingContainer as GridEditFormItem;<br> string value = ((DataRowView)bidingContainer.DataItem)[dataField].ToString();<br><br> ddl.Items.Add(value);<br><br> }<br> <br><br> IOrderedDictionary IBindableTemplate.ExtractValues(Control container)<br> {<br> OrderedDictionary dick = new OrderedDictionary();<br> dick.Add(dataField, ddl.SelectedValue.ToString());<br> return dick;<br> }<br> }I wanted to make it only ITemplate but i got an error saying i need to make it IBindableTemplate.
On ItemDataBound i find the template, get the dropdownlist and bind it to my DataSet.
When i push the "Edit" command it works. The problem appears when i push "Update".
On the "GridTelerik_UpdateCommand" event i need to Extract the new values.
But i get an error at : ((GridEditableItem)e.Item).ExtractValues(newValues);
The error is : "Editor cannot be initialized for column : <columnName> - where columnName is the uniqueName of the TemplateColumn.
Is there a way i can resolve it. Does it have a problem because i instantiate the column editItemTemplate on Load? In case there is a better solution for this situation please advice me.
Thanks.
