Hi all,
I have added templeted textbox column from code behind to my webgrid...
However if I do a paging or sorting I loose the text box and the column comes up like a regular column..
Any ideas on how to resolve this issue?
Thanks for your help..
Joel
Hello t_val_u.
You shouldn't have to do anything to get the TemplatedCOlumnRestored event to fire. As long as it is handled properly you should be fine. If you create the event through the designer it should be fine. Take a look at the grids HTML and see if there is an event handler in the <UltraWebGrid> tag. You can enter the events directly in the HTML, which is what the designer does, or you can create them in code. To create an event handler in code, use this C# syntax:
this.UltraWebGrid1.TemplatedColumnRestored += new TemplatedColumnRestoreEventHandler(UltraWebGrid1_TemplatedColumnRestored);
As soon as you type the += intellisense will fill the rest of the text out for you and you just have to hit the tab key to fill the rest in.
Hello everybody,
I am quite new to the Infragistics WebGrid. This thread was very helpful concerning TemplatedColumns. Now my problem:
I dragged a webgrid into an aspx-page.
TemplatedColumnRestored event programmatically and do a postback, the controls inside the TemplatedColumn are gone. I debugged and found out that the TemplatedColumnRestored event is not fired.
When I add the TemplatedColumnRestored event in the Designer from Visual Studio it is fired?
Did anyone else experience this?
Or is there a special order in how you have to add the event handlers or in which stage of the page life cycle is the best place?
If I could bind the TemplatedColumnRestored event at design time it would not be a problem, but I need to create the webgrid programmatically and need the TemplatedColumnRestored event, too. Also, the InitializeLayout and InitializeRow events.
Thanks in advance.
t_val_u
Hello m_valle.
Adding a WebDateChooser or any other type of editor is no different than adding a drop down combo box. The problem with the InitializeRow code snippet that you have provided is that you are creating a new instance of a CellItem. The CellItems collection is part of the templated column object, and it is a collection of type System.Object. It is the same length as the grids rows collection, and you index it by using the rows index. So, if the grid has 10 rows the CellItems collection for a templated column in that band has 10 items. Each item corresponds to a specific row. So, to access the control contained in the templated column of row[5], you access the 5th element of that columns CellItems collection by using the FindControl method and converting the object to a specified type.
When a column is declared to be a templated column, it already has a CellItems collection which will be set to the proper length to match the rows collection. All you need to do is access the correct element of that collection and add or retrive controls from it. You don't need to create new instances of CellItems; they already exist.
No, I haven't tried it... but I can suggest you this link [1] that is an example of a Webdate choose in a cell. It's inside the Grid Group - Editing data - Date chooser in cell.
[1] http://samples.infragistics.com/2007.3/webfeaturebrowser/default.htm
Ulises
I'd like to know if you have tried to insert the webdatechooser or webcombo in template column ?
I've execute the following test but the component not show in the column:
"inizialize_row event"
if (e.Row.Index == 0) {
Infragistics.WebUI.UltraWebGrid.TemplatedColumn m_Col = (Infragistics.WebUI.UltraWebGrid.TemplatedColumn)m_Cell.Column; Infragistics.WebUI.UltraWebGrid.CellItem m_Item = new Infragistics.WebUI.UltraWebGrid.CellItem(m_Cell); Infragistics.WebUI.WebDataInput.WebDateTimeEdit m_WdtEdit = new Infragistics.WebUI.WebDataInput.WebDateTimeEdit(); m_Item.Controls.Add(m_WdtEdit); m_Col.CellItems.Add(m_Item); // m_Col.CellItems[m_DataTable.Rows.Count-1] = m_Item; // m_Col = new WebDateTimeTemplateColumn(); GridControl.Columns[m_Cell.Column.Index].ValueList.Key = "WebDateTime"; }
I've 2^ question, I'de liek to know if is possible set the value through "client side mode" and not through server side mode ?
Thanks all, AspTex