Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 26, 2008 09:44
open dhtmlx forum
problem with ch cell type

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("<rows>");

while (dr.Read())
{
Response.Write("<row id=\"" + dr["Emp_ID"] + "\">");
Response.Write("<cell type=\"ed\" class=\"myCss\">" + dr["Emp_ID"] + "</cell>");
Response.Write("<cell type=\"ed\">" + dr["First_Name"]+"</cell>");
Response.Write("<cell type=\"calendar\">" + dr["Last_Name"] + "</cell>");
Response.Write("<cell type=\"ch\">" + dr["Gender"] + "</cell>");
Response.Write("</row>");
}
Response.Write("</rows>");
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?
Answer posted by Support on Feb 26, 2008 10:13
The values of ch must be 0 or 1 , if you entered any value, for example
    <cell>false</cell>
It will be threated as not "0" - and cell will be rendered in checked state.