After upgrading to 9.1.5, my combobox within a gridview (EditForm) template which I am populating dynamically "onEdit" stopped displaying the data.
The funny part is that the datasource shows "10+" rows, but after the databind is executed when the edit template is rendered, the combobox acts as if it is disabled (no items).
I guess there is no attach feature here. So I will just paste my code behind. When creating a grid to try out, just drag and drop a grid view, a combo box to the edit template and a combobox outside the gridview.
Code Behind:
public partial class TestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ASPxGridView1.DataSource = Subject.GetData();
ASPxGridView1.DataBind();
ASPxComboBox1.DataSource = ReferenceData.GetData();
ASPxComboBox1.TextField = "Description";
ASPxComboBox1.ValueField = "LookUpCode";
ASPxComboBox1.DataBind();
}
protected void ASPxGridView1_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
{
ASPxComboBox ddRegion = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBox2") as ASPxComboBox;
ddRegion.DataSource = ReferenceData.GetData();
ddRegion.TextField = "Description";
ddRegion.ValueField = "LookUpCode";
ddRegion.DataBind();
}
}
public class ReferenceData
{
private string description;
private string lookupcode;
public string Description { get { return description; } set { description = value; } }
public string LookupCode { get { return lookupcode; } set { lookupcode = value; } }
internal static List<ReferenceData> GetData()
{
ReferenceData refData;
List<ReferenceData> refDataList = new List<ReferenceData>();
for (int i = 0; i < 10; i++)
{
refData = new ReferenceData();
refData.Description = "description" + i.ToString();
refData.LookupCode = i.ToString();
refDataList.Add(refData);
}
return refDataList;
}
}
public class Subject
{
private string subjectId;
public string SubjectID { get { return subjectId; } set { subjectId = value; } }
internal static List<Subject> GetData()
{
Subject subject;
List<Subject> subjectList = new List<Subject>();
for (int i = 0; i < 10; i++)
{
subject = new Subject();
subject.SubjectID = i.ToString();
subjectList.Add(subject);
}
return subjectList;
}
}