.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

help me

Posted By: bhavin     Posted Date: January 23, 2009    Points:2   Category :Windows Application
in C#.Net(Windows app.)i have one grid view in that first column is the check box when i click any one of the check box,all that check true or selected record color changed,and any one column in data gridview became a non editable means when we double click of the particular column cell then the effect is nullify mean not done anything so how to solved that problem and one another problem is that i want to add one another column at the last of data gridview which is the button column,so hows to add that button column runtime in data grid view so ples tell me code of that urgently

Author: Praveen             
Posted Date: January 25, 2009     Points: 5   

To change the row color use cell_formatting event eg.

private void dataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
int rowIndex = e.RowIndex;
DataGridViewRow theRow = dataGrid.Rows[rowIndex];

double cellValue = (double)theRow.Cells["Quantity"].Value;
if (cellValue > 50)
theRow.DefaultCellStyle.BackColor = Color.Red;
// theRow.DefaultCellStyle.BackColor = Color.Blue;

To Disable a perticular cell disable to edit use Cell_Editing event

Hope this helps

Happy Coding

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend