I was just playing with the following code:
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath(“codebase/imgs/”);
var flds = “ID,First Name,Last Name,Gender”;
mygrid.setHeader(flds);
mygrid.setInitWidths(“100,100,100,100”);
mygrid.setColAlign(“right,left,right,right”);
mygrid.setColTypes(“ed,ed,ed,ch”);
mygrid.setColumnIds(“Emp_ID,First_Name,Last_Name,Gender”);
mygrid.setSkin(“light”);
mygrid.init();
mygrid.loadXML(“Get.aspx”);
myDataProcessor = new dataProcessor(“Update.aspx”);
myDataProcessor.enableDataNames(true);
myDataProcessor.setUpdateMode(“off”);
myDataProcessor.setTransactionMode(“GET”);
myDataProcessor.init(mygrid);
myDataProcessor.enableDebug(true);
Code in Get.aspx:
Response.ContentType = “text/xml”;
Response.ContentEncoding = Encoding.UTF8;
con.Open();
DataReader dr = cmd.ExecuteReader();
Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
Response.Write("");
while (dr.Read())
{
Response.Write("<row id="" + dr[“Emp_ID”] + “”>");
Response.Write("<cell type=“ed” class=“myCss”>" + dr[“Emp_ID”] + “”);
Response.Write("<cell type=“ed”>" + dr[“First_Name”]+"");
Response.Write("<cell type=“calendar”>" + dr[“Last_Name”] + “”);
Response.Write("<cell type=“ch”>" + dr[“Gender”] + “”);
Response.Write("");
}
Response.Write("");
con.Close();
Response.End();
the problem iam running into is that when i uncheck the cell with the check box the data is being sent correctly to the server (Gender is set to false) and the database is updated. But when i refresh the page i see that the check box is checked even when the database has its value false. Why is this happeneing?
The values of ch must be 0 or 1 , if you entered any value, for example
false
It will be threated as not “0” - and cell will be rendered in checked state.