plz help me.....
I want to disable current row of Datagrid after clicking button....
plz give the code for that....
Disable a row of dataGrid
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Aug 17, 2009, 2:36 AM EDT
You Accomplish your task by Below Code Set Read-only Property of Row to True
and Change the back ground and Fore Ground Color to be Gray
so it will indicate user that row is disabled or read only :)
Friend , dont forget to mark "Do you like answer" it will give me some credits :)
and let me know if you are having any difficulties to implement the code :) i will assist you :)
private void button1_Click(object sender, EventArgs e)
{
//Index of Row You want to Disable Here we Disabling 2nd Row
int RowIndex = 1;
// Set Rows Readonly Property to True
dataGridView1.Rows[RowIndex].ReadOnly = true;
//Change The Back Color so it will Simulate Disable
dataGridView1.Rows[RowIndex].DefaultCellStyle.BackColor = Color.Gray;
//Change the For Color White
dataGridView1.Rows[RowIndex].DefaultCellStyle.ForeColor = Color.White;
}