Free Support Forum - aspose.com

Checkbox value does not change when checked

Hi,

I've been working on a web aspose.grid control and have programatically added some check boxes to some cells. I have then checked by default and I can see the value true when I evaluate the controll. However, If I uncheck it and try to evaluate the value its still true.

Has anyone had this sort of probelm?

Thanks

John

Hi John,

Thanks for considering Aspose.

Do you use CheckBox validation. Could you create a sample test project to show the issue, we will check it soon. And by the way which version of Aspose.Grid.Web you are using.

Thank you.

Hi,

Thanks for the reply. I'm using aspose.total version 1.4.0.6.

I am using checkbox validation. I will work up a sample to show what I am doing.

Thanks

John

ok, here is the sample application. Here you can see that I am creating a checkbox validation and then I have a procedure to find the value of the checkbox. The problem here is that if I unckeck the checkbox and click the button to parse the grid I am still shown that the value is true even though I unchecked it.

I need to be able to access the values server side or somehow refresh the grids data before validating the cell's value.

Here is the mockup code.

protected void Page_Load(object sender, EventArgs e)

{

GridWeb1.ForceValidation = true;

if (!IsPostBack)

{

GridWeb1.WebWorksheets.Clear();

GridWeb1.WebWorksheets.Add();

//set sheets selectedIndex to 0

GridWeb1.WebWorksheets.ActiveSheetIndex = 0;

WebWorksheet sheet = GridWeb1.WebWorksheets[0];

WebCells cells = sheet.Cells;

WebCell cell = cells["A1"];

cell.CreateValidation(ValidationType.CheckBox, true);

cell.PutValue(true);

}

}

protected void ParseGrid_Click(object sender, EventArgs e)

{

WebWorksheet sheet = GridWeb1.WebWorksheets[0];

WebCells cells = sheet.Cells;

WebCell cell = cells["A1"];

Response.Write("Cell Value: " + cell.Value.ToString());

}

Hi,

Well, you have to submit grid's data before evaluating the checkbox's value. You may either click on edit, save button etc. or add a line of code to your code:

protected void Page_Load(object sender, EventArgs e)

{

GridWeb1.ForceValidation = true;

if (!IsPostBack)

{

GridWeb1.WebWorksheets.Clear();

GridWeb1.WebWorksheets.Add();

//set sheets selectedIndex to 0

GridWeb1.WebWorksheets.ActiveSheetIndex = 0;

WebWorksheet sheet = GridWeb1.WebWorksheets[0];

WebCells cells = sheet.Cells;

WebCell cell = cells["A1"];

cell.CreateValidation(ValidationType.CheckBox, true);

cell.PutValue(true);

ParseGrid.Attributes["onclick"] = "GridWeb1.updateData(); return GridWeb1.validateAll();";

}

}

protected void ParseGrid_Click(object sender, EventArgs e)

{

WebWorksheet sheet = GridWeb1.WebWorksheets[0];

WebCells cells = sheet.Cells;

WebCell cell = cells["A1"];

Response.Write("Cell Value: " + cell.Value.ToString());

}

Thank you.

Thanks for the reply, that worked well.

Thanks

John