HI
My need is
i have a radcheckbox and rad grid.while selecting or ticking the checkbox it will select whole row and after i press update button that row should be updated .How can I do This?Can anyone Help Me?
I have to do this in C#
My code is this
for (int i = 0; i < DeleteGridView1.Rows.Count;i++)
{
String cguid = DeleteGridView1.Rows[i].Cells[1].Value.ToString();
SqlCommand cmd = new SqlCommand();
Program.StrSql = "update QbCompany set ActiveFlag = 0 Where CompanyGUID='"+ cguid + "'";
cmd.Connection = Program.QbSysDbCon;
cmd.CommandText = Program.StrSql;
cmd.ExecuteNonQuery();
}

Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 3:15 AM EDT
Vivek Joy139 reputationPosted Sep 1, 2015, 3:46 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 4:00 AM EDT
Vivek Joy139 reputationPosted Sep 1, 2015, 4:09 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 4:12 AM EDT
Vivek Joy139 reputationPosted Sep 1, 2015, 4:42 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 4:48 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 4:50 AM EDT
Vivek Joy139 reputationPosted Sep 1, 2015, 4:58 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 1, 2015, 7:15 AM EDT
private void Delete_Click(object sender, EventArgs e)
{
SysConfig QbSysConfig = new SysConfig();
String StrCompanyGuid = QbSysConfig.ToString();
for (int i = 0; i < DeleteGridView1.Rows.Count;i++)
{
String a = DeleteGridView1.Rows[i].Cells[0].Value.ToString();
String cguid = DeleteGridView1.Rows[i].Cells[1].Value.ToString();
SqlCommand cmd = new SqlCommand();
Program.StrSql = "update QbCompany set ActiveFlag = 0 Where ' '='"+ a + "'";
cmd.Connection = Program.QbSysDbCon;
cmd.CommandText = Program.StrSql;
cmd.ExecuteNonQuery();
}
MessageBox.Show("Deleted");
} }
As per my understanding of ur requirement is in grid view contains check box. When click check box enable delete button and delete record in a table?
Or
When you click on check selected row I'd based update activeflag=1 ?
Please check and confirm which scenario u need?
Vivek Joy139 reputationPosted Sep 2, 2015, 8:30 PM EDT
Vivek Joy139 reputationPosted Sep 3, 2015, 12:52 AM EDT
Raja TRank #685 · 3.5K reputationPosted Sep 3, 2015, 12:56 AM EDT
{
SysConfig QbSysConfig = new SysConfig();
String StrCompanyGuid = QbSysConfig.ToString();
for (int i = 0; i < DeleteGridView1.Rows.Count;i++)
{
String a = DeleteGridView1.Rows[i].Cells[0].Value.ToString();
String cguid = DeleteGridView1.Rows[i].Cells[1].Value.ToString();
SqlCommand cmd = new SqlCommand();
Program.StrSql = "update QbCompany set ActiveFlag = 0 Where ' '='"+ a + "'";
cmd.Connection = Program.QbSysDbCon;
cmd.CommandText = Program.StrSql;
cmd.ExecuteNonQuery();
}
MessageBox.Show("Deleted");
} }
Vivek Joy139 reputationPosted Sep 3, 2015, 4:07 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts