Problem fixed...in the RowDataBound event, I check if its in edit
mode, if so, then I check to see if the cell has a value and set the
ReadOnly property based on that.
protected void GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
DataControlFieldCell cell;
TemplateField field;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Edit
|| e.Row.RowState == (DataControlRowState.Edit
| DataControlRowState.Alternate))
{
GridViewRow row = e.Row;
for (int index = 1; index < 10; index++)
{
TextBox4.Text = TextBox4.Text + "\r\n" +
String.Concat("SudokuCell", index).ToString();
TextBox theCell =
(TextBox)row.FindControl(String.Concat("SudokuCell", index));
// lblStatus2.Text = lblStatus2.Text +
(theCell.Text
== @"").ToString();
if (theCell.Text == @"")
{
theCell.ReadOnly = false;
//theCell.Enabled = false;
//TextBox1.Text = theCell.ToString();
}
else
{
theCell.ReadOnly = true;
//theCell.Enabled = false;
theCell.BorderStyle = BorderStyle.None;
theCell.BorderWidth =
System.Web.UI.WebControls.Unit.Pixel(0);
}
}