Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
WebDataTree Checkbox not checked after databind
posted

Want to have the checkbox be checked (or not) depending on bound data.  Am unable to get it to do so.  Very simple test code. (sorry for state of what follows; have tried to edit it repeatedly to 'nice it up'..  editor s**ks!)

 .axpx
<ig:WebDataTree ID="WebDataTree1" runat="server" CheckBoxMode="biState">
<DataBindings>
  <ig:DataTreeNodeBinding DataMember="tb1" KeyField="Id" TextField="Name" ValueField="CheckValue" />
</DataBindings>
</ig:WebDataTree>

.aspx.cs
public partial class TestWebDataTree : System.Web.UI.Page
{protected void Page_Load(object sender, EventArgs e){
  
DataSet ds = GetData();
   WebDataTree1.DataSource = ds;
   WebDataTree1.DataBind();}
protected DataSet GetData(){
  
DataSet ds = new DataSet("ds1");
  
DataTable dt = new DataTable("tb1");
   dt.Columns.Add(
"Id", System.Type.GetType("System.Int32"));
   dt.Columns.Add(
"Name", System.Type.GetType("System.String"));
   dt.Columns.Add(
"CheckValue", System.Type.GetType("System.Int16"));
  
DataRow dr;
  
dr = dt.NewRow();
   dr[
"Id"] = 1; dr["Name"] = "One"; dr["CheckValue"] = Infragistics.Web.UI.CheckBoxState.Checked; 
   dt.Rows.Add(dr);
   ds.Tables.Add(dt);
return ds;}}

I expect 1 row with "One" as the text and the checkbox checked. Text = "One", but checkbox is not checked. Please help.

P.S. Is there a way to do this with a Template and a %@Eval()% ?

Thx