Mar 05, 2010, 1:45 AM
Something wrong with the PropertyGrid
i want to generate the PropertyGridParameter with ajax method,but the editors did't work as the code below.
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Coolite.Ext.Web.NumberField nf = new NumberField();
nf.ID = ds.Tables[0].Rows[i]["id"].ToString();
nf.AllowBlank = false;
CReadWriteXML cw = new CReadWriteXML(int.Parse(ds.Tables[0].Rows[i]["????"].ToString()), int.Parse(nf.ID));
float total = float.Parse(cw.ReadIDTotal());
Coolite.Ext.Web.PropertyGridParameter cp = new PropertyGridParameter();
// cp.Params.Add(new Coolite.Ext.Web.Parameter());
cp.Name = string.Format("{0}({1}{2}{3})", ds.Tables[0].Rows[i]["????"].ToString(), ChangeLogtic(ds.Tables[0].Rows[i]["?????"].ToString()), ds.Tables[0].Rows[i]["???"].ToString(), ds.Tables[0].Rows[i]["?????"].ToString());
cp.Encode = true;
cp.Value = total.ToString();
cp.Mode = ParameterMode.Raw;
target tr = new target();
tr.name = cp.Name;
tr.id = nf.ID;
Coolite.Ext.Web.ToolTip tp = new ToolTip();
tp.Html = "???:" + total.ToString();
string sf=ds.Tables[0].Rows[i]["?????"].ToString();
switch (sf)
{
case "equal":
{
if (total == float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
case "morethan":
{
if (total > float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
case "morethanequel":
{
if (total >= float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
case "lessthan":
{
if (total < float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
case "lessthanequel":
{
if (total <= float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
case "notequel":
{
if (total != float.Parse(ds.Tables[0].Rows[i]["???"].ToString()))
{
tp.Icon = Icon.Accept;
}
break;
}
default: tp.Icon = Icon.Error; break;
}
li.Add(tr);
nf.ToolTips.Add(tp);
cp.Editor.Clear();
cp.Editor.Add(nf);
Mark.Source.Add(cp);
}
Mark.SetSource(Mark.Source);
}
and then ,i want to read the Source in the below code,and the Source has no item included in it . is this is a bug? foreach (PropertyGridParameter cp in this.Mark.Source)
{
XmlNode xdetail = xd.CreateElement("detail");
XmlAttribute xaid = xd.CreateAttribute("id");
xaid.Value = cp.Editor.Editor.ID;
XmlAttribute xavalue = xd.CreateAttribute("value");
xavalue.Value = cp.Value;
xdetail.Attributes.Append(xaid);
xdetail.Attributes.Append(xavalue);
xrecord.AppendChild(xdetail);
}
i can't read any item from the source at all .