How to get a multiline head using DataGridView?
-
I want to have a GridView like this. But it seems DataGridView only support one line head, is there anyway to do this? By the way, I have tried NetVantage. But I think it's a little bit slow when loading controls, so I'm wondering if I can just using DataGridView to do this? :) Personal Info Contact Info Name Age Gender Mobile Phone Email Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data
-
I want to have a GridView like this. But it seems DataGridView only support one line head, is there anyway to do this? By the way, I have tried NetVantage. But I think it's a little bit slow when loading controls, so I'm wondering if I can just using DataGridView to do this? :) Personal Info Contact Info Name Age Gender Mobile Phone Email Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data
DataGridView doesnt supports multiple headers for a column, however you can separate the text of header by this ( | ) that will look like a line multiple headers
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
DataGridView doesnt supports multiple headers for a column, however you can separate the text of header by this ( | ) that will look like a line multiple headers
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
The method you say can't slove my problem. I want the head can be change the width, so if I use the "|" to instead of column, it won't work.
so why dont you use columns, they will work as you want
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
I want to have a GridView like this. But it seems DataGridView only support one line head, is there anyway to do this? By the way, I have tried NetVantage. But I think it's a little bit slow when loading controls, so I'm wondering if I can just using DataGridView to do this? :) Personal Info Contact Info Name Age Gender Mobile Phone Email Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data Data
Drag and drop a GridView and name it as GridView1 Try the below code protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable("Employee"); //Name Age Gender Mobile Phone Email dt.Columns.Add("Name"); dt.Columns.Add("Age"); dt.Columns.Add("Gender"); dt.Columns.Add("Mobile"); dt.Columns.Add("Phone"); dt.Columns.Add("Email"); dt.Rows.Add("Anoop", "25", "Male", "996633352", "02255566", "anoopukrish@gmail.com"); GridView1.DataSource = dt; GridView1.DataBind(); } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridView gridView = (GridView)sender; GridViewRow gridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell tableCell = new TableCell(); //add Personal Info tableCell.Text = "Personal Info"; tableCell.Attributes.Add("style", "text-align: center"); tableCell.ColumnSpan = 3; gridViewRow.Cells.Add(tableCell); //Add Contact Info tableCell = new TableCell(); tableCell.Attributes.Add("style", "text-align: center"); tableCell.Text = "Contact Info"; tableCell.ColumnSpan = 3; gridViewRow.Cells.Add(tableCell); GridView1.Controls[0].Controls.AddAt(0, gridViewRow); } } ... There by u get the desired output... :-\ ____________________:cool: Anoop Unnikrishnan
-
Drag and drop a GridView and name it as GridView1 Try the below code protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable("Employee"); //Name Age Gender Mobile Phone Email dt.Columns.Add("Name"); dt.Columns.Add("Age"); dt.Columns.Add("Gender"); dt.Columns.Add("Mobile"); dt.Columns.Add("Phone"); dt.Columns.Add("Email"); dt.Rows.Add("Anoop", "25", "Male", "996633352", "02255566", "anoopukrish@gmail.com"); GridView1.DataSource = dt; GridView1.DataBind(); } protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { GridView gridView = (GridView)sender; GridViewRow gridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell tableCell = new TableCell(); //add Personal Info tableCell.Text = "Personal Info"; tableCell.Attributes.Add("style", "text-align: center"); tableCell.ColumnSpan = 3; gridViewRow.Cells.Add(tableCell); //Add Contact Info tableCell = new TableCell(); tableCell.Attributes.Add("style", "text-align: center"); tableCell.Text = "Contact Info"; tableCell.ColumnSpan = 3; gridViewRow.Cells.Add(tableCell); GridView1.Controls[0].Controls.AddAt(0, gridViewRow); } } ... There by u get the desired output... :-\ ____________________:cool: Anoop Unnikrishnan
-
so why dont you use columns, they will work as you want
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can
It's seems you didn't get what I have said. I want a grid like this, but not so complex. I just want the head part is the same as showing in the picture. http://p.blog.csdn.net/images/p_blog_csdn_net/venus0314/2d96ca3709e3450ea3a91d9bf909021f.png[^]
-
It's seems you didn't get what I have said. I want a grid like this, but not so complex. I just want the head part is the same as showing in the picture. http://p.blog.csdn.net/images/p_blog_csdn_net/venus0314/2d96ca3709e3450ea3a91d9bf909021f.png[^]
then use third party controls
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can