Tuesday, June 19, 2012

ASP.NET Gridview cell value alignment

we can easily align our gridview cell value on load event like this

  for (int i = 0; i < damageDetailsGridView.Rows.Count; i++)  
         {  
           damageDetailsGridView.Rows[i].Cells[0].HorizontalAlign = HorizontalAlign.Center;  
           damageDetailsGridView.Rows[i].Cells[1].HorizontalAlign = HorizontalAlign.Left;  
           damageDetailsGridView.Rows[i].Cells[2].HorizontalAlign = HorizontalAlign.Center;  
         }  

the output of the grid look like


Enjoy..

C# print file on LAN Printer

If you want to print any file on network printer then you can try with this code block // Change Default Printer System.Ma...