Aug 24, 2012, 1:40 PM
[CLOSED] PropertyGrid editor issue
Hi every one,
I'm trying to set the editor for each property by code-begind but doesn't work. The editor is TextFied for all attributes.
Here is my code.
Thank you very much.
I'm trying to set the editor for each property by code-begind but doesn't work. The editor is TextFied for all attributes.
Here is my code.
<ext:PropertyGrid runat="server"
ID="UserCustomAttributes"
Title="<%$ Resources:Resource,CustomAttributes %>"
>
<Source>
<ext:PropertyGridParameter></ext:PropertyGridParameter>
</Source>
</ext:PropertyGrid>
protected void LoadCustomAttributes(int USERID)
{
DataTable dt = SigmaSportUser.UserSelect_AllCutomAttributes(USERID,1);
PropertyGridParameterCollection pList = new PropertyGridParameterCollection();
foreach (DataRow dr in dt.Rows)
{
PropertyGridParameter param = new PropertyGridParameter();
param.Value = dr["VALUE"].ToString();
param.DisplayName = dr["ATTRIBUTEID"].ToString();
param.Name = dr["ATTRIBUTEID"].ToString();
switch(dr["DATATYPE"].ToString())
{
case "System.String":
{
TextField tf = new TextField();
tf.AllowBlank = false;
param.Editor.Add(tf);
break;
}
case "System.DateTime":
{
DateField df = new DateField();
df.AllowBlank = false;
param.Editor.Add(df);
break;
}
}
pList.Add(param);
}
UserCustomAttributes.SetSource(pList);
UserCustomAttributes.DoLayout();
}
Wha am I doing wrong?Thank you very much.
Last edited by Daniil; Nov 19, 2012 at 9:21 AM.
Reason: [CLOSED]