Creating Tables inside of datagrid / repeater with rows that span columns


Currently I am using a repeater control with paging that I implemented myself. Because the result set can be somewhat large and I'm storing the entire result in view state, the paging is going extremely slow.

My basic need is a control that displays records in the format below, but also has some kind of paging. I have thought about the datagrid but I don't know if this is within its ability.

               Col 1 | Col 2 | Col 3
                data      data    data
Message    data that spans all columns
Field          data that spans all columns
Value         data that spans all columns


I have this effect achieved with the Repeater, but as I said, it's slow. The important factors in this scenerio are that the four rows displayed above represent a single record from the database. Another factor is that, there are some cases where I don't want the Message, Field, and Value rows to be displayed at all, but rather I want them to be hidden.

I would prefer to use the datagrid because it has its own paging; however, I haven't seen any examples for something like this with the datagrid.

My current plan is to shift from storing things in viewstate to the session so the server can handle it and I'll just have to force the session to clear manually.

I'm out of idea's here and anything any of you can think of will really help. Thanks!
jbaisdenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rinkujainCommented:
yes you can do that with the help of template column ,like
<asp:TemplateColumn HeaderText="test">
<ItemTemplate>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="1">
<TR>                                                 <TD>column containing your data e.g. <%#DataBinder.Eval(Container.DataItem,"RULEID")%></TD>
                                                      <TD></TD>
                                                      <TD></TD>
</TR>
<TR>                                                      <TD colSpan="2"></TD>
                                                      <TD>gfj</TD>
                                                      </TR>            </TABLE>
                                    </ItemTemplate>
                              </asp:TemplateColumn>
jbaisdenAuthor Commented:
The problem with using a template column is that it represents 1 column. This means I have only 1 headerText property, but in reality, I need 4. If I manually add the headers to the actual template column then they will repeat for every record and this is not desired.
rinkujainCommented:
then you have find in which circuminstances you want merge columns, like on what basis as then you have to do it programatically through code. like
e.Item.Cells(0).Attributes.Add("colspan","4")
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

rinkujainCommented:
or give the exact scenario, so that i can try with that tommorow

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rinkujainCommented:
e.g. , you have total 4 column ,and want to span 4th row then following code will work:
-In databound column

i
if (e.Item.ItemIndex==3)
                        {
                              e.Item.Cells[0].ColumnSpan=4;
                              e.Item.Cells[0].HorizontalAlign=HorizontalAlign.Center;
                              e.Item.Cells[1].Visible=false;
                              e.Item.Cells[2].Visible=false;
                              e.Item.Cells[3].Visible=false;
                         
                        }

hope it will work for u
jbaisdenAuthor Commented:

I have this figured out for the most part. Thanks for your help.
jbaisdenAuthor Commented:
I will post the details later.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.