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

grid with rowspans in data and colspans in headers

4 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
TelDev
Top achievements
Rank 1
TelDev asked on 12 Jul 2011, 03:19 PM
Hi,

I want to create a grid as attached in the image.
As you can see I have rowspan set to first 2 columns of the grid. I am setting the rowspan by comparing the column value in row and previous row, and by combining the rows. So i am able to achieve the first part.
columns country, currency, col3,col4,col5 are declared statically in aspx page. so far so good.
I have random number of contact columns (in turn divided into 3 columns). I want to add these columns to Grid in code-behind. I checd in the documentation of grid and it says

RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file.

How to further build the Grid?

Thanks
Teldev




4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2011, 06:34 AM
Hello,

One suggestion is to create the all columns dynamically. The folllwing help article and demo will help you to achieve this.

Create Telerik RadGrid entirely in the code behind.
OnPageInit.
OnPageLoad.

Thanks,
Shinu.
0
TelDev
Top achievements
Rank 1
answered on 13 Jul 2011, 09:03 AM
Thanks for the reply Shinu,

Actually I hvae many static columns(That too GridTemplateColumns). So i am looking some way of combing static and dynamic creation of columns.
0
TelDev
Top achievements
Rank 1
answered on 14 Jul 2011, 03:53 PM
Can anyone from Telerik Team help me.
0
Iana Tsolova
Telerik team
answered on 18 Jul 2011, 10:13 AM
Hi Teldev,

As you already found mixing static and dynamic columns is not suggested. In your case I would also suggest that you create the entire grid in code behind, on Page_Init. Or, if you have no template columns, you can define the grid columns on Page_Load.
Other than this, you can try leaving the declarative columns as they are, and add the dynamic columns on Page_Load. But as this is not supported scenario you should not expect the grid to work properly.

Greetings,
Iana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
TelDev
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
TelDev
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or