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
20
WebCombo
posted

Hi

i am working with WebCombo control i had few issues with it when i am trying to bind the data to the dropdown. It is having ID and description. when i went to developer tools i did not find values in LI's which is related to the dropdown. please find the  below code which i tried in one way 

this.ProgramCombo. DataSource = this.programs;
// this.ProgramCombo.TextField = "Description";
// this.ProgramCombo.ValueField = "ID";
// this.ProgramCombo.DataKeyFields = "Code";
// this.DataBind();

and the other way is 

public void FillComboFromCollection(IList lookupCol, string collectionValueMember, string collectionDescriptionMember)
{

this.DataSource = lookupCol;
this.TextField = collectionDescriptionMember;
this.ValueField = collectionValueMember;
this.DataBind();

// FillComboFromCollection(null, lookupCol, collectionValueMember, collectionDescriptionMember);
}

Please let me know turn around time to get it resolved.

  • 10685
    Offline posted

    Hello shalini, 

    In general, you can add static list items via the Design pane. However, in case you add the list items via code behind, these list items will not be visible in the Design pane list items collection.  

    In case there is another issue, can you add some more details as your asking is a bit unclear? 

    - What type of data source this.programs is? Please notice, there are several requirements for the data source type. For example, in case of using objects - should implement IEnumerable.

    - I can see you are using a custom method to fill the required list items, and yet what is the outcome? Is the WebDropDown correctly populated? 

    You will find online example binding to different data source types here

    I am looking forward more feedback from you.