The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
i am displaying rows into a DBG.and i placed a context menu strip control on it. after displaying rows in a grid i am selecting a row and applying a color to that row by clicking on contextmenu strip button but it is not applying that color
my code is private void Form1_Load(object sender, EventArgs e) {
string con = "data source=SERVER;uid=sa;pwd=safertek;database=master"; string cmd = " select * from emp"; SqlDataAdapter da = new SqlDataAdapter(cmd, con); DataSet ds = new DataSet(); da.Fill(ds, "emp"); gridDataBoundGrid1.DataSource = ds.Tables[0];
private void openToolStripMenuItem_Click(object sender, EventArgs e) { int i = gridDataBoundGrid1.CurrentCell.RowIndex; int c = gridDataBoundGrid1.CurrentCell.ColIndex; this.gridDataBoundGrid1[i, c].BackColor = Color.GreenYellow; }
SRSri Rajan Syncfusion Team June 13, 2008 09:43 AM UTC
Hi Hari,
Thank you for your interest in Syncfusion products.
You need to handle QueryCellInfo event to change the back color of the selected cell. Here is the code. //To Change the backcolor of selected cell. void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if ((e.RowIndex == i && i!=-1)&& (e.ColIndex == c && c!=-1)) { e.Style.BackColor = Color.Red; i = -1; c = -1; } else { if(e.RowIndex>0 && e.ColIndex>0) e.Style.BackColor = Color.White; } }
int i = -1, c = -1; private void openToolStripMenuItem_Click(object sender, EventArgs e) { i = this.gridDataBoundGrid1.CurrentCell.RowIndex; c = this.gridDataBoundGrid1.CurrentCell.ColIndex; this.gridDataBoundGrid1.Focus(); }
Please let me know if this helps.
Best Regards, Srirajan
ADAdministrator Syncfusion Team June 14, 2008 06:31 AM UTC
ThankYou Srirajan
Can you plz provide any documentation regarding GridBoundDataGrid events like Model_QueryCellInfo, PrepareViewStyleInfo, CurrentCellAcceptedChanges.. thanks in advance
SRSri Rajan Syncfusion Team June 16, 2008 06:40 AM UTC
Hi Hari,
Thank you for your continued interest in Syncfusion products.