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

htmlViewDefinition Question

1 Answer 151 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymundo Lopez
Top achievements
Rank 1
Raymundo Lopez asked on 03 Dec 2009, 03:01 PM
Good Morning,

I just recently started working wth the htmlView for grids as I need to represent rows in a more structured fashion. I love the fact you can define the layout using an HTML table like file and load it into the view definition. I have created this file and gone through the process, however, when running the following code:

        protected   void    InitializeDataEntry()
        {
            htmlView = new HtmlViewDefinition();
            htmlView.RowTemplate.ReadXml("/vcenter/address.html");

            gridAddressEditList.ViewDefinition = htmlView;

        }

I receive the following error:

Object reference not set to an instance of an object.


This is my address.html file. This seems to load fine:

<table>
 <tr>
     <td rowspan="2">Type</td>
  <td>Address1</td>
  <td>City</td>
  <td rowspan="2">Postal Code</td>
 </tr>
 <tr>
  <td>Address 2</td>
  <td>State</td>
 </tr>
</table>

I am new to using the viewDefinitions and thought I had followed the example code pretty closely. Could anyone point me in the right direction here?

Thanks,

Chris Eisnaugle

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 04 Dec 2009, 08:51 AM
Hi Raymundo Lopez,

Thank you for contacting us. The table defined in html serves to define the row layout. All columns in it must exist in RadGridView too. You should add these columns - just as in the normal table view - to the Columns collection. If this doesn't help, please send me your application and we will try to locate and address the issue. I am looking forward to your reply.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal. http://admin.telerik.com/Default.aspx?Context=Support&Control=%7e%2fUserControls%2fSupport%2fThreadReply.ascx&ST=263896&SM=0&PURL=%2fDefault.aspx
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Raymundo Lopez
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or