Using Headers spannig multiple columns & aspbound columns together in the same datagrid

I am trying to format a datagrid to display my data. I have some headers that span multiple columns. I was able to implement this using the following code structure.

<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<tr>
<td rowspan="2" colspan="1" width="40%">Model</td>
<td rowspan="1" colspan="4">Sales</td>
<td rowspan="2" colspan="1">Distribution</td>
<td rowspan="2" colspan="1">Target Qty</td>
<td rowspan="2" colspan="1">Difference</td>
</tr>
<tr>
<td>Campaign</td>
<td>Credit</td>
<td>Advance</td>
<td>Total</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# DataBinder.Eval(Container, "DataItem.model") %></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><%# DataBinder.Eval(Container, "DataItem.target_qty") %></td>
<td>&nbsp;</td>
</tr>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

However, I am not able to use automatic column sorting provided by Datagrid since I am not able to use boundcolumns in the structure above.
Does any one know how to implement headers spanning multiple columns and asp bound columns together ?
Thanks
0
sirac
9/12/2003 2:43:16 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
578 Views

Similar Articles

[PageSpeed] 48

Sirac, I need to do exactly the same thing? Did you ever figure it out?

0
DotNetHammer
9/17/2003 7:52:45 PM
Unfortunately I couldn't find anyway to do that. I decided not to use headers spanning multiple columns until I figure out a solution.
0
sirac
9/18/2003 1:12:20 PM
Reply:

Similar Artilces:

Create multiple datagrid columns from single column
I have a datagrid that generates a single column of data that is extremely long. I'd like to find a method to create multiple columns from the single column so the data is easier to read. I have tried the DIV method to create a scroll bar, but it's still a single column of data. The other goal is to make the data printable. If I can crop the column when it hits the bottom of the page, and then start it again on a new column it will be easier to read and printable. Is this possible? Should I be using a different control other than a datagrid? Thanks!------------------------------...

how to put column values as column headers in datagrid
Hi, I am trying to develop a report. Basically we have two tables named A and B. In Table A we have columns DelivTypeId EstDate CompDate In Table B we have columns DelivTypeId DelivDesc I have written a join select statement to get the DelivDesc, StartDate, Enddate so the result would be like DelivDesc StartDate EndDate Tiering1 8/31/2004 9/20/2004 Tiering2 8/31/2004 9/20/2004 Tiering3 8/31/2004 9/20/2004 Tiering4 8/31/2004 9/20/2004 I need my datag...

column header to span two columns in a datagrid display
Is it possible for a column header to span two columns? If so how would this be done? Thanks In the ItemDataBound (or ItemCreated) check if Item is of type Header and if so - define the colspan property of the Cell object which you want to define the Colspan for and delete the next Cell from hte DataGridItem CheersBug [MCSD] Is it possible to span header column in design view only. using some kind of CSS. I'm using ASP,NET 3.5 and GridView...

Reference gridview column index using column headers
 Greetings,I have several GridViews all showing different collections of similar product data.  Due to changes in codes used to distinguish properties such as color and size, I'm having to write several rules into the row databound events.  The issue I'm having is that the group who will be using the application haven't finalized the order of the columns, so everytime I reorder the columns, I have to changes all the column indexes in my code behind so that the rules are being applied to the right columns. I'd like to know if there is a way to reference the colu...

How to retrieve controls in column header of a DataGrid?
I have controls in column header of a my DataGrid control grdDocumentDate. I use grdDocumentDate.FindControl() to look for the controls in column header but could not get them. Is there any way to solve the problem? ImageButton ib = (ImageButton)grdDocumentDate.FindControl("ibDocDate");ib always returns null.<asp:datagrid id="grdDocumentDate" style="Z-INDEX: 118; LEFT: 24px; POSITION: absolute; TOP: 176px" runat="server" BorderWidth="0px" AllowSorting="True" AutoGenerateColumns="False" OnItemCommand="ShowMoreDetailsCommand" BackColor="Silver"    Width="704px"> ...

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...

Setting Datagrid Column to invisible when Column is an AutoGeneratedColumn NOT a bound Column
Hi all, Just like the title says, I'm trying to set a column to invisible but I'm unable to do so. If I bound the column I can used the code: me.datagrid.Column.Item(1).Visible = False But since I'm wanting the column NOT to be bound (there are a number of sql scripts that populate the same datagrid so I cannot bound all the columns since the columns are different for each script etc etc etc) how do I set an AutoGeneratedColumn to invisible?? Please help! Andrewwww.codingmayhem.com - VB.NET, C#, Silverlight, Javascript, HTML, CSS, T-SQL, MySQL and SQLitewww.headshot...

Using Bound Controls in Gridview Column Header
Hi Folks, Please tell me how do I use bound controls in Gridview Column Header. Lets say, I want to see the User Name as the Header Text for a Gridview Column.Red in Heart... Hi, I think, If you want to bind any field in your database to the Header of the Column in the GridView control. Then you can add a TemplateField in the gridview control and then add a Textbox or Label field in the HeaderTemplate and then bind it to the field in your Database table. Regards, Manish www.ComponentOne.com    Manish Singhalwww.ComponentOne.com Try this,  <asp:TemplateField> ...

How To Update A Column In A DataGrid Using C#.NET?
 How To Update A Column In A DataGrid Using C#.NET? I am getting InvalidCastException as (Specified cast is not valid) while updating 2nd column in a datagrid? Id,firstname,lastname are the three columns of my datagrid respectively. I wanted to edit the second column(lastname) and update it. I did the following code in DataGrid's updatecommand(),but failed to update ! Int varid=(int)DataGrid1.DataKeys[e.Item.ItemIndex]; TextBox lnm=(TextBox)e.Item.Cells[2].Controls[0]; string str=lnm.Text ;  SqlCommand cmd=new SqlCommand("update customer set lastna...

Can you control selectability of DataGrid column headers?
We have a DataTable with sorting enabled.  The person that I am working for has a complaint:  he wants the user to be able to select a column for sorting whenever the mouse is over the text in the header text of the column;  as things stand now, the cursor must be positioned  just below the text before the browser will allow selection.  Is there a way to control this, or  is this functionality that is internal to the browser? This behavior appears to only be an issue in Internet Explorer, not Firefox. the sort headers are simply an anchor...

Issue with Template Columns & Bound Columns while updating the data in a GridView control
Hi, I'm facing the below problem (In general, ObjectDataSource is driving me crazy ! ) I have a simple gridview control and an ObjectDataSource is used to populate the grid. I'm trying to update a row and the corresponding tableadapter methods & stored procedure are in place. Each row has 2 checkboxes and 2 textboxes in edit mode. When the change the values in edit mode and hit update, the checkbox values changed are saved into the Database properly, whereas the textbox values are not being saved. If the textbox column is a bound column then the column is updated with <NULL> in...

How to manipulate images and combe multiple database columns into one column in a GridView control
Hi Folks,I'm hoping someone can help me out with something.I am trying to put together a photo album as a learning exercise and have a GridView control with two columns linked to an Access Data Source. In the left hand column (called Image) I want to display the photo and in the right hand column (called Details) I want to provide details such as Date, Location, People and Comments, Camera Type etc. Each of these is columns is taken from the database I have set up.However, I have am having some problems:1: At the moment I have been able to get the image to display (using an image column ...

Column within a column in a DataGrid
Hi, I have a DataGrid on which I would like to divide a particular column into 2 to display a number information on the sub column?? Visually I'm speaking something like this below. +----------------+-----------------+ | ACCOUNTID | ACCOUNT NO | +----------------+-----------------+ | 1000 | | 125364 | | 1015 | | 125365 | | 1025 | | 125312 | +-----------------+----------------+ My question again is how to see this extra sub column within the ACCOUNTID Column here. Looking for a quick reply. Th...

Datagrid:--> Adjusting column width in edit mode without using template column?
Hello All, I have a datagrid that is populated with data from a database programmatically. It is currently equipped with an Edit command column. When the edit button is clicked the datagrid expands as the update, cancel, and edit-textboxes appear in the grid. I have currently been binding my datasource to the grid without using template or bound columns. Is there a way to maintain my initial datagrid size even when the edit command button is clicked or do I have to reprogram my datagrid with template columns? If I could get some assistance in this area it would be great!! Can you paste...

Web resources about - Using Headers spannig multiple columns & aspbound columns together in the same datagrid - asp.net.presentation-controls

Code division multiple access - Wikipedia, the free encyclopedia
Code division multiple access ( CDMA ) is a channel access method used by various radio communication technologies. It should not be confused ...

Girl, 5, stabbed multiple times outside apartment building in Ballarat; man arrested
A five-year-old girl is in a critical condition after being stabbed multiple times in Ballarat.

Multiple probes in case of missing former Olympian and funds' seller
At least three investigations are underway in the case of an investment dealer and former Canadian Olympic rower who has gone missing from Victoria. ...

Tim Hortons Abruptly Shuts Multiple U.S. Locations, Taking Customers, Staff By Surprise 76
Managers and employees at Tim Hortons locations in New York and Maine say they were let go with virtually no notice this week, amid a round of ...

iOS 9 How-To: Quickly delete multiple images in Messages to free up space without losing your conversations ...
... actually gets stored twice on the device: within Photos and within Messages. In this How-To article, I’m going to discuss how to delete multiple ...

CNN Reporter Describes Multiple Explosions During Overnight Raid
Around 1:30 am ET, CNN’s Atika Shubert was reporting from the Paris suburb of Saint Denis where police were conducting an overnight raid tied ...

Ten killed in multiple bombings, armed attacks around Baghdad
Ten killed in multiple bombings, armed attacks around Baghdad

ROEV lets you use multiple charging networks with one account
Filed under: Green , Green Automakers , Electric Blink, ChargePoint, and EVgo are partnering up with ROEV, a new association that will let you ...

Derrick Rose's Double Vision Could Last Multiple Months, Says Fred Hoiberg - Bleacher Report
As criticism of Derrick Rose's play crests in Chicago, Bulls head coach Fred Hoiberg offered some insight into why the former MVP is struggling: ...

Kate Hudson dumped Nick Jonas because she ‘wants to pursue multiple people’
... But not for long, The source also said the Bride Wars star wants to get into the dating scene again. And soon. ‘Kate wants to pursue multiple ...

Resources last updated: 11/25/2015 7:39:13 PM