This is a migrated thread and some comments may be shown as answers.

radGridView with load on demand template, dinamycally created

1 Answer 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vicente
Top achievements
Rank 1
Vicente asked on 05 Oct 2012, 11:17 AM
Hello,
I'm new to the radGridView component and HtmlViewDefinition and I'm not sure about understanding it. I have to do something like this:

Inside a grid, display with load on demand a new table with this style:

+------------ +------------------------+---------------+------------+  
|  IMAGE   |     SIZE        |   39        |    40     |    Sizes created dinamycally
|               +------------------------------+---------+  
|               |    QUANTITY  | txtBox1   | txtbox2 |    ......txtBox to insert the quantity...............
+------------------------------------------------------+




In the other projects I've done, I created the template at the form load, and filled it when the rowSourceNeeded event was fired. 
But now, i have to create the template dinamycally, and with that style (with HtmlViewDefinition?). Is this possible? What are the steps to do? Any ideas, please!

Thank you!!

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 10 Oct 2012, 08:24 AM
Hi Vicente,

View definitions can be applied independent from the underlying data source. The only condition is that all columns defined in the view definition should exist in the data layer. To apply a view definition you should set the ViewDefinition property of the desired template. Here is a sample:
HtmlViewDefinition view = new HtmlViewDefinition();
 
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows.Add(new RowDefinition());
view.RowTemplate.Rows[0].Cells.Add(new CellDefinition("CustomerID"));
view.RowTemplate.Rows[0].Cells.Add(new CellDefinition("CompanyName"));
view.RowTemplate.Rows[0].Cells.Add(new CellDefinition("City"));
view.RowTemplate.Rows[0].Cells.Add(new CellDefinition("Country"));
view.RowTemplate.Rows[1].Cells.Add(new CellDefinition("Phone"));
 
myTemplate.ViewDefinition = view;

Find further information on how to create and use view definitions check our online documentation. You can consider also the GridView >> Columns >> Grid Views example from our demo application.

The following article describes how to create load-on-demand hierarchy in RadGridView.

I hope this helps.
 
Regards,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Vicente
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or