Okay so here's the problem I am having. I am wanting to show a multicolumn radcombobox in a radgrid from a custom inline edit form (user control). I can get it to work fine on a page but from what I can tell when you run the same code from a user control that is being referenced by a radgrid for CRUD. What is happening is that the dynamic template that I am creating doesn't get applied until after that data is bound. From the looks of it the page load doesn't get touched at all. So from what I can tell I am trying to call a databind within a databind which is my problem.
So for the radgrid when you use a custom form you call most of your bindings in the
and then you can bind lists etc. in there. This is not a problem. I can even databind the combobox. Where the problem comes in is when I want to databind with a multicolumn format on the combobox.
The above code is in the system event handler databound method.
The problem from what I can see is that the Template that I am creating isn't firing until after the data is bound to the grid so it doesn't format the multicolumns properly.
Any help on a work around would be great. I have gone through all of the forums and all of the different sections of the radgrid and radcombobox api to see if this was addressed and I didn't find anything.
Thanks,
Kevin
So for the radgrid when you use a custom form you call most of your bindings in the
private void InitializeComponent(){ this.DataBinding += new System.EventHandler(this.RandomName_DataBound);}and then you can bind lists etc. in there. This is not a problem. I can even databind the combobox. Where the problem comes in is when I want to databind with a multicolumn format on the combobox.
ComboBox.ItemTemplate = new ItemTemplate();ComboBox.ItemDataBound += ComboBox_ItemDataBound;ComboBox.Width = Unit.Pixel(500);ComboBox.AllowCustomText = true;ComboBox.MarkFirstMatch = true;ComboBox.DataSource = GetVendorList();ComboBox.DataTextField = "Name";ComboBox.DataBind();foreach (RadComboBoxItem item in ComboBox.Items){ item.DataBind();}The above code is in the system event handler databound method.
protected void RandomName_DataBound(object sender, EventArgs e){ // do stuff here}The problem from what I can see is that the Template that I am creating isn't firing until after the data is bound to the grid so it doesn't format the multicolumns properly.
class ItemTemplate : ITemplate{ public void InstantiateIn(Control container) { Table table = new Table(); table.Width = Unit.Percentage(100); TableRow mainRow = new TableRow(); TableCell cell1 = new TableCell(); cell1.Width = Unit.Percentage(40); cell1.DataBinding += new EventHandler(cell1_DataBinding); mainRow.Cells.Add(cell1); TableCell cell2 = new TableCell(); cell2.DataBinding += new EventHandler(cell2_DataBinding); cell2.Width = Unit.Percentage(30); mainRow.Cells.Add(cell2); TableCell cell3 = new TableCell(); cell3.DataBinding += new EventHandler(cell3_DataBinding); cell3.Width = Unit.Percentage(30); mainRow.Cells.Add(cell3); table.Rows.Add(mainRow); container.Controls.Add(table); } private void cell1_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Text"); } private void cell2_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Attributes[\"Type\"]"); } private void cell3_DataBinding(object sender, EventArgs e) { TableCell target = (TableCell)sender; RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer; target.Text = (string)DataBinder.Eval(item, "Attributes[\"Phone\"]"); }}Any help on a work around would be great. I have gone through all of the forums and all of the different sections of the radgrid and radcombobox api to see if this was addressed and I didn't find anything.
Thanks,
Kevin
