G
Guest
Using Visual Studio 2003, C#, .NET 1.1.
I have a web form with a few textboxes, a couple of dropdown lists, and a
data grid. The data grid is populated from a SQL stored procedure. The user
can select a row to edit by clicking an EDIT link, which triggers an Edit
command. The textboxes and dropdowns are then populated with the data from
the data grid.
I've added a new column to the data grid and a checkbox control. The column
is populated with either "YES" or "NO" based on whether the SQL field value
is 1 or 0 (integer field). This works just fine. The new column is column 8.
What I'm struggling with is having the checkbox be checked if the data grid
value is "YES" and clear if the value is "NO." Here's what I tried:
if (e.Item.Cells[8].Text.Trim(); == "YES") chkAlerts.Checked = true;
else chkAlerts.Checked = false;
I also tried:
string Cell8 = e.Item.Cells[8].Text.Trim();
if( Cell8 == "YES") chkAlerts.Checked = true;
else chkAlerts.Checked = false;
Am I on the right track? If not, can someone please help me out?
Thanks!
I have a web form with a few textboxes, a couple of dropdown lists, and a
data grid. The data grid is populated from a SQL stored procedure. The user
can select a row to edit by clicking an EDIT link, which triggers an Edit
command. The textboxes and dropdowns are then populated with the data from
the data grid.
I've added a new column to the data grid and a checkbox control. The column
is populated with either "YES" or "NO" based on whether the SQL field value
is 1 or 0 (integer field). This works just fine. The new column is column 8.
What I'm struggling with is having the checkbox be checked if the data grid
value is "YES" and clear if the value is "NO." Here's what I tried:
if (e.Item.Cells[8].Text.Trim(); == "YES") chkAlerts.Checked = true;
else chkAlerts.Checked = false;
I also tried:
string Cell8 = e.Item.Cells[8].Text.Trim();
if( Cell8 == "YES") chkAlerts.Checked = true;
else chkAlerts.Checked = false;
Am I on the right track? If not, can someone please help me out?
Thanks!