Gridview with multiple header rows - extra rows not being rendered

Hi,

I have just installed the CSS Friendly Control Adapters and now my gridviews are not displaying dynamically added header rows.

Code for adding rows is like so:

Dim headerCell As New TableHeaderCell

headerCell.ColumnSpan = gridview.Columns.Count

headerCell.Text = heading

Dim rowHeader As New GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal)

rowHeader.Controls.Add(headerCell)

CType(gridview.Controls(0), Table).Rows.AddAt(0, rowHeader)

 

This is typically used for adding a nicely formatted heading row and it is a requirment that i must have this extra row. I sometimes need to add an additional row for sub grouping of columns.

I do this on the RowDataBound event.

Looking at the rendered source I do not see my rows anywhere however when doing an excel export (by passing the grid) I can see my rows however there is nothing in them.

I did try to search this forum for previous posts covering this issue but could not find anything, any help would be greatly appreciated. Thank You.

0
DavidF
1/12/2009 3:07:01 AM
asp.net.css-control-adapters 905 articles. 0 followers. Follow

3 Replies
579 Views

Similar Articles

[PageSpeed] 21

Just to verify i reflected the GridView class. It appears that only one header row can be rendered. However if you are looking to attach a row as an additional header, you would have to do it after the DataBind event and before the render.

I can whip up a code sample if you need one.


Brad Foley
Web Developer
http://www.blfoley.com
--------------------------
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
0
blfoleyus
1/12/2009 3:25:55 AM

Hi, Thanks for the quick response. I am not sure i follow you though.

What I am asking is "I have been adding rows in the past without any issue but now after installing the adapters it no longer works"

Are you saying you have a solution for adding the extra rows when using the adapters? If so then yes a brief sample would be great.

 Thanks.

0
DavidF
1/12/2009 3:36:19 AM

I'm sorry, through my one blood shot eye, and lack of mountain dew, i missed the CSS adapter part, i apologize. Trying to recreate it, i have the same problem.


Brad Foley
Web Developer
http://www.blfoley.com
--------------------------
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
0
blfoleyus
1/18/2009 4:02:02 PM
Reply:

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Gridview row-by-row rendering
Hello guys,I have a bit of a dilemma. I have a Gridview control and I want it to be rendered row-by-row on the page.I tried to do it this way:protected void myGv_RowDataBound(object sender, GridViewRowEventArgs e) { StringBuilder renderedOutput = new StringBuilder(); StringWriter strWriter = new StringWriter(renderedOutput); HtmlTextWriter tWriter = new HtmlTextWriter(strWriter); e.Row.RenderControl(tWriter); Response.Write(renderedOutput.ToString()); Response.Flush(); }But this is totally wrong because IE doesn't render a table until the end tag is provided. Do you have an...

adding a blank header row /row above the header row
is it possible to add a blank row above the header row in gridview for adding some links and buttons the links will respond to thae data in the grid and the buttons are for login / regisration etc....  if yes how it can be done or how do i achieve it. Its better that u create a table with a single row with columns matching the GridView columns. Set the table width same as the GridView width. This will make the GridView Look as if there is a row above its header.Please do not forget to click Mark As Answer on the post that helped you. Regards,Iam Srikanth Reddy....

Freezing the column header row of a GridView control using CSS
I am struggling getting my Gridview in ASP.NET 2.0 Visual Studio 2005 to freeze the column header row and provide for scrolling of the remaining data rows. My specific problems right now are: (IE7) column headers freeze as intended and do not scroll  BUT scroll bar is not initially visible to user (requires scrolling with mouse wheel before scroll bars are exposed in gridview) (Firefox 2.0.10) column header row just scrolls out of sight like any other row  Here is part of my default.css in my default App_Theme folder: /* So the overflow scrolls */ div.coveragesContainer ...

Freeze Headers(Multiple row headers) in GridView
Hello all,        I'm developing web application with asp.net2.0+C#.   Requirement : GridView with Multiple Header rows. When vertical scroll, headers freeezed (GridView rows only scrollable). When horizontal scroll, GridView's 1st column freezed (1st Column of GridView is freezed & remaining columns with Headers should be scrollable). Something like as:-   School Name:- ABC English School Academic Year:- 2007-2008   Type   OPEN   S.C.   N.T.   O.B.C. Boys Girls ...

CSS Friendly Control Adapters not support dynamically created rows in GridView?
I have a dynamically created row in GridView control. But it will not appear when I use CSS Friendly Control Adapter. I have to set adapterenabled=false to make it work. But I will loss all the table style in this way. Any better ideas to solve this problem? This is the code behind to add a new row.protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e) {GridViewRow insertedRow = new GridViewRow(GridView3.Rows.Count, GridView3.Rows.Count, DataControlRowType.DataRow, DataControlRowState.Normal); TableCell cell = new TableCell();cell.Text = " hello"; cel...

Data Controls insert rows into gridview then insert rows from gridview into SQL Table
Hello there, I'm still new at performing miracles with code . Currently I am having trouble with my latest coding adventure I have a web application which records jobs and labour assigned to jobs. The issue in particular I'm having is the way in which labour is to be assigned. I want to use standard controls (Textbox, Dropdownlist) to record the values into a gridview (ie,put multiple rows into the gridview using the controls). Then, when all the inserting is complete, the user clicks a submit button to insert all the rows from the gridview into a database table. The reason for...

select multiple rows with its row highlighted in GridView
Hello everyone, I'm not using any checkbox or select command to select the row in the GridView, I use the "RowDataBound" event in the GridView for the "onmouseover" click and row select.  That works fine for me but I want to have the functionality to select a multiple rows with its row highlighted and have a row selected count. For example, If I select a row, it hightlights that row and if I select another row, it will do the same thing and have the previous row still highlighted.  I have been looking for a way to implement this but can't find a ...

Selecting the multiple rows in GridView and inserting the selected rows to another Gridview & Performing some operations on it
 Dear All, I have become mad for solving this problem. Please Help me. I have a Gridview bound to a datasource. I inserted the CheckBox Control in Templet to select certain rows. Gridview1 contains some products id & name.I want to insert the selected rows in to second Gridview  and in the second Gridview I need to add two more colums AdvicedQty & AcceptedQty(TextBox Cotrol).The user will select few products in Gridview1 & clicks add which will be added another gridview then in second Gridview he enters the AdviceQty & AcceptedQty.After entering the data he cli...

css toolkit adapters- apply css style to gridview row in code (c#)
I was trying to change the colour of a row in a gridview depending on data contained within using MyGridView_RowDataBound, and found a nice little change to the css adapters to allow this. Thought I should share. Add the following code before "return className.Trim();" in the function GetRowClass(GridView gridView, GridViewRow row) in GridViewAdapter.cs. (I keep this in ~/App-Code/Adapters/)if ((row.RowState == DataControlRowState.Normal)) { className += row.CssClass; } In your gridview css file add the colors you need EG: .MyGridViewCSSselectorCl...

Multiple grid rows per Data row in GridView
I have a dataset that is binded to a gridview. The dataset has 5 fields and a description. I want to display 1 row for the 5 short fields and 1 row underneath it for the description. (per record)   For example: ID Name  Surname Field3 Field 4 1   John     Smith      blah    blah     This is the long description for  John Smith spanning 5 cells 2   Peter    Parker     blah    blah     This is t...

Display multiple table rows in a single Gridview row?
I have two tables:   transportreply |id| |submitby| |transport| 2008 |id| |liftclub| |liftclubsize| |workfromhome| |leave| |submitby| In the transportreply, there are multiple rows with information submitted by the same user originating from a checkboxlist.  What I need is an inner join of the two tables that display all the results on one Gridview row.  Currently my code looks like this: Results.aspx<table align="center" width="900" bgcolor="#E6E6E6" class="table3"><tr><td><div class="td4&q...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

Adding a blank DataGridItem row or header row to a GridView object...
I really haven't seen any examples of adding a blank header row or item row to a GridView control....   Is there a way to do this? thanks.   doug If you handle the RowCreated event then you can determine the row type (if it is header or data) and then reformat it or insert a row after or before it http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspxHTH,Phillip Williams,http://www.webswapp.com good article...  thanks.. My scenario is one where I have over 15 columns, so I need to keep them aligned.  I found that when I implemented the soluti...

add data from multiple rows in table to one row in gridview
 heya is there any way of adding data from multiple rows in table to one row in gridview. eg. ipc                 column 1 ,            2 ,                       3,                 4  1,    11111                 33                  &nbs...

Web resources about - Gridview with multiple header rows - extra rows not being rendered - asp.net.css-control-adapters

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012

DotNetKicks.com - Upcoming stories
DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 1/15/2016 7:14:06 AM