Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1664
  • Last Modified:

Datagrid column merging & Column Header Text Change in multi line

Hi,

I would like to mearge two columns 0f datagrid. and also i want to display the columns title in multiple line by using c#.

0
arvsha
Asked:
arvsha
1 Solution
 
rajaloysiousCommented:
As far as i know, Merging isnt possible

DataColumn dc;
dc.ColumnName = "Column One"
dc.Caption = "Column\nOne";   //\n is new line character

Cheers
0
 
diablocuteCommented:
Hi, I'm not sure if I understand your question correctly. But I had an occasion where I had to merge two columns in the footer and I did as the following.
===========================================================
(1) In your ItemDataBound method,             
  if (e.Item.ItemType == ListItemType.Footer)
  {
     e.Item.Cells[0].Text = "Merge Col1 and col2";
     e.Item.Cells[0].Attributes.Add("colspan","2");
     e.Item.Cells[1].Visible = false;
   }
============================================================
(2) to display the columns title in multiple line
In your ItemDataBound method,             
  if (e.Item.ItemType == ListItemType.Header)
  {
     e.Item.Cells[0].Text = "line1<br>line2";
   }

0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now