Want to start new header column 2 columns into first row

I want to add a new header to the first row of my gridview but i want to start 2 columns into the first row. I tried row.Cells.AddAt(2,Cell); but this gives me an error.so how can it be done?

   Here is my code so far........ 

   protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
    {
        SortedList creatCels = new SortedList();
        creatCels.Add("1", "Test,2,1");

        GetMyMultiHeader1(e, creatCels); 

    }  

public void GetMyMultiHeader(GridViewRowEventArgs e, SortedList GetCels)
    {

        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridViewRow row;
            IDictionaryEnumerator enumCels = GetCels.GetEnumerator();
            bool skip = true;
            row = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);

            while (enumCels.MoveNext())
            {

                string[] cont = enumCels.Value.ToString().Split(Convert.ToChar(","));
                TableCell Cell;
                Cell = new TableCell();
                Cell.ColumnSpan =
                Cell.RowSpan = Convert.ToInt16(cont[2].ToString());
                Cell.ColumnSpan = Convert.ToInt16(cont[1].ToString());
                Cell.Controls.Add(new LiteralControl(cont[0].ToString()));
                Cell.HorizontalAlign = HorizontalAlign.Center;
                Cell.ForeColor = System.Drawing.Color.Black;
                Cell.BackColor = System.Drawing.Color.Brown;
                row.Cells.Add(Cell);
            }

            e.Row.Parent.Controls.Add(row);

        }
    }

0
James_Dean
8/26/2008 9:46:23 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
483 Views

Similar Articles

[PageSpeed] 13

To answer my own question....simply set the background color and foreground color of the first table cells to white so that they wont be displayed.......
0
James_Dean
8/27/2008 1:26:01 PM
Reply:

Similar Artilces:

FooterTemplate wants to start on Column 2 not Column 1
Hi all, I don't have a lot of experience using the FooterTemplate in the Gridview (used it once to insert/add new records).  This problem seems awkward and I'm confident I'm overlooking something simple.  Basically, no matter what I do here, the text in the FooterTemplate starts in column 2.  Below is a sample of my code.  The commented out lines are what I originally had before I tried defining templates hoping that would resolve the issue but it didn't.  I also added Text for the FooterTemplate columns for those columns that I'm not displaying....

How to divide 1 GridView Row with 1 column in 2 Rows with 5 columns?
Hi; I have a GridView with 10 rows and 1 column. How can I do to this GridView show the same data, but with 2 rows and 5 columns? In classic ASP, I made it this way: While (NOT rsFotos.EOF) if i mod 5 = 0 then Response.Write "</tr><tr>" end if ... Someone can help? :)  You have to use a custom template and lay the table out the way you want, either dropping controls in the template or creating a custom ITemplate that takes care of it for you. http://professionalaspnet.com/archive/2006/06/15/Useing-ITemplate-in-the-Data-Controls.aspxChris L...

gridview1 and i have 5 column in table1.. i want coulumn1 ofn gridview1 to display 2 field (2 column of table1) ??
hello friends gridview1 and i have 5 column in table1.. i want coulunm1 ofn gridview1 to display 2 field (2 column of table1). how can i do this ? cheersMark as me if my question or my answer can be helpful for you :) Hi What I understood from your query is that you want to bind the table data with grid as follows: gridview1.column1 with table1.column1 gridview2.column2 with table2.column2  and so on. if is that the case you can bind the columns with the grid view columns in that manner in design as follows: <asp:GridView ID="GridView1" runat="server&quo...

When is a column not a column?
I have several extremely similar datawindows that I have to maintain that go against the same table. Recently, I had to add a column to that table, and also add the column to ALL of these datawindows that go against this table. I added the column to the first datawindow, set up the edit control style, etc. I then did a copy/paste of the columns edit control to the remaining dw's (of course remembering to first add the column in SQL). Everything (update props, column specs, column props) seems to indicate that the pasted column is linked to the column I selected, HOWEVER, when I...

i want new row in for each column in datagrid
 the sample code, only addes columns but i want each column should be in new row, any addition in code will be appreciated... thanx   Dim dv As New DataView(dt)   Dim dt As New DataTable()  For j = 0 To 5            Dim datarowObject1 As DataRow = dt.NewRow()            Dim editcol3 As HyperLinkColumn            editcol3 = New HyperLinkColumn            ...

How to go through a datatable row by row and column by column
Hello, I have a dataset with a datatable and I need to insert each row from the datatable on my sql table, anyway there may be errors, so some rows may not be inserted because primary key constraints,  So I need to show the rows that are not inserted in a gridview, the hard thing to do is to go through all the datatable,  is there an wasy way to do it?MCPD ENTERPRISE APPLICATION DEVELOPER Start by looking herehttp://msdn2.microsoft.com/en-us/library/system.data.common.dataadapter.update.aspxPerform an update of your dataset, and if a row fails, you can mark it as invalid.You can ...

How to place in DataGrids’s first column table’s column name, in second Datagrid’s column table’s column value?
Hello I use C#. I’m interesting are there samples solved my problem. Andrew. You will need to loop through the datasource of the datagrid or through the datagrid items and fetch the values for the second datagrid.Sonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum Thank you! I solved my problem at the server cite. Andrew. ...

GridView : Freezing First Columns and Freezing Column's Headers
Hi Looking for code that freezes the first two columns and the column's headers in a GridView, so as to give a similar behavior and the appearance of Excel, but in Visual Web Developer, I've found a link that show a very efficient solution, but applies just to a DataGrid control in IE. I've found lots of additional information in the web, but I think the best aproach is this... http://web.tampabay.rr.com/bmerkey/examples/locked-column-csv.html http://www.codeproject.com/aspnet/FreezePaneDatagrid.asp Please, look at this alternative solution also... may be ...

New Column in GridView which accumilative adds the totals from another column. #2
Hello everyone, I've tried to search for a solution on here but I've come up empty. Here is an example of my gridview   DATE     |     Amount    |01/06/08           2002/06/08           3003/06/08           1004/06/08           80 What I need now is a column next to Amount which accumilative adds the "Amount"...

data presenttion with dynamic header and columns also fliping rows/columns
 I have to data in data set in the form  CustomerName , dateof theWeek abc                    1 januaryabc1                    1 januaryxyz                     1 january dfg                       2 januaryhsg            &nb...

Calculated column from columns in same row??
Hi everyone - Is there a way to display a calculated value in a column based on values from the same row? Using a datagrid thanks tony Sure. Have a function declared for your OnItemDataBound: Sub CalculateValues(ByVal sender As Object, ByVal e As DataGridItemEventArgs) dim total as Integer = CType(e.Item.FindControl("col1"), Integer) + CType(e.Item.FindControl("col2"), Integer) e.Item.FindControl("totalCOlumn").Text = total End Sub I think it would be something like that.Sarahttp://www.ilovecode.com If yo...

WHERE COLUMN=1 AND COLUMN=2
I have a table that I need to select ALL values that are submitted, so I can't use COLUMN IN (1,2) as this would return all rows with either 1 or 2. Same goes for using OR. So how do I transform the impossible query "WHERE COLUMN=1 AND COLUMN=2" into one that actually returns a result? In this example what I want to return would be all id's that have 1 AND 2 in the column in question, just to be be clear. Cheers! /Eskil   A column can only have ONE value. It can't be both 1 and 2. -- "Mark As Answer" if my reply helped you -- ...

Why 2 <td> columns in Design tab are displayed as 1 column only in a browser presentation?
I have coded a Table with 1 <tr> and 2 <td> to read fildes from 2 folders.The Design tab did show coding 1 and coding 2 as 2 cells/columns side by side in one row of a table.  However, the browser presentation showed the files ofthe 2nd folders directly under the files of the 1st folder.  Why the browser presentation showed only one coulmn while the Design tabshowed 2 columns?  What might be the reasons for this mistake? TIA,Jeffrey      Please post your HTML.Please remember to "mark as answered" posts that ...

I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row.
 Hi, Let say I've 4 rows in a table. I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row. Thanks in advance Asghar Ali Mohammed http://www.aliwebdev.com(Web Designer and Developer)Do not forget to "MARK AS ANSWER" on the post that helped you. If you can use Linq, you can use Skip. http://msdn.microsoft.com/en-us/vcsharp/aa336757.aspxThanks, EdMicrosoft MVP - ASP/ASP.NET Hii dear..U can fire the Query select Top(3) from Table1 order by id desc.. "A conclusion is whe...

Web resources about - Want to start new header column 2 columns into first row - asp.net.presentation-controls

Politics, Political News - The Capitol Column
Covering the politics of science, technology, business, entertainment, Capitol Hill, and health.

Column vector - Wikipedia, the free encyclopedia
... unclear because it lacks inline citations . Please improve this article by introducing more precise citations. In linear algebra , a column ...

Column 8
More on the pointless &quot;rebranding&quot; of passengers as &quot;guests&quot; and other labelling gymnastics (Column 8, for some days), from ...

Column 8
Ah, Boxing Day &ndash; when the ruins of Yuletide feasts and ransacked cellars are flensed&#8203; and gargled, cricketers and sailors bake in ...

Jets column: Cheveldayoff's big gamble with Byfuglien
The big rearguard may not have been 100 per cent, but he was out there in the Winnipeg Jets' 1-0 victory over the Minnesota Wild Friday night. ...

RD Recap: Penthouse Ends Print Run; Phil Kadner Ends Column
... group of reporters, not to mention good friends,” Gehrke, who also interned at the Examiner, told FishbowlDC… Phil Kadner writes his last column ...

Price Drop: Column Division
Column Division 3.0 Device: iOS Universal Category: Education Price: Free, Version: 3.0 ( iTunes ) Description: This math app can be used ...

This Column Nails It
“ How Racists Talk About Tamir Rice “: For as long as I’ve been a newspaper columnist — 13 years and counting — I’ve been on the receiving end ...

Tim O'Sullivan column: Edelman's return comes just in time for Patriots
Concord Monitor Tim O' Sullivan column: Edelman's return comes just in time for Patriots Concord Monitor Yes, New England was also playing ...

Philly high schooler gets lesson in hate after penning column on Missouri race friction
Philadelphia High School student Michael Moroz was prepared for backlash over his op-ed that ran in the school newspaper, but what he didn’t ...

Resources last updated: 1/21/2016 1:19:00 PM