Click here to Skip to main content
15,894,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to merge dulicate cells of columns in datagridview?
Ah! Except emply cells
Posted

 
Share this answer
 
Comments
inlya 17-Dec-12 1:43am    
Thanks!
I have tried it.
When my datagirdview have emply cell then the I get Errors from program.
Please help me with that
[no name] 17-Dec-12 1:45am    
Not sure but, apply one condition (i.e cell == null) and perform your desire operation...
inlya 17-Dec-12 1:47am    
That not work...
[no name] 17-Dec-12 1:52am    
make that cell's border zero or something like that..
for (int r = gvLaborderstatus.Rows.Count - 2; r >= 0; r--)
{
GridViewRow gvRow = gvLaborderstatus.Rows[r];
GridViewRow gvPrevRow = gvLaborderstatus.Rows[r + 1];
if (gvPrevRow.Cells[25].Text == gvRow.Cells[25].Text && HttpContext.Current.Server.HtmlDecode(gvPrevRow.Cells[25].Text).Trim() != "")// && gvPrevRow.Cells[26].Text == gvRow.Cells[26].Text)
{
gvPrevRow.Cells[17].Visible = false;
if (gvPrevRow.Cells[17].RowSpan < 2)
gvRow.Cells[17].RowSpan = 2;
else
gvRow.Cells[17].RowSpan = gvPrevRow.Cells[17].RowSpan + 1;
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900