Forums

Combobox not displaying values within Gridview after upgrading to 9.1.5

Last post 7/6/2009 9:06 PM by Rajeev Venkitaraman. 0 replies.
Sort Posts: Previous Next
  • Rajeev Venkitaraman

    Combobox not displaying values within Gridview after upgrading to 9.1.5

    7/6/2009 9:06 PM
    • Not Ranked
    • Joined on 5/11/2009
    • Posts 2

    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;
            }
        }

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.