Hello, Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tableau Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}
I trying to add DropDown column in a my UltraWebGrid, I’m using this code
this.listUltraWebGrid.Bands[0].Columns.FromKey("Country").Type = ColumnType.DropDownList;
ValueList countryList = this.listUltraWebGrid.Bands[0].Columns.FromKey("Country").ValueList;
his. countryList.DataSource =Country.GetCountries(); //return a list of object country
countryList.DataSourceID = "IdCountry";
countryList.DisplayMember = "NameCountry";
countryList.DataBind();
I have an object Country who contain 2 properties “IdCountry” as Int And “NameCountry” as a string
I want to display NameCountry in the dropdawn list but I always get “IdCountry” as a result !!
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tableau Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}
Can anyone help me to resolve this problem?
Thanks in advance for your kind reply.
Regards,
I think you should be setting the DataMember intead of the DataSourceID
thanks for your answer,
i tried categoryList.DataMember = "IdCountry" and i still have the same problem
Have you set the columns' DataTye to Integer? (Assuming your IdCountry is an integer)
yes,
this.SupplierListUltraWebGrid.Bands[0].Columns.FromKey("Country").DataType = System.Type.GetType("System.Int32").ToString();
i did it like this, because DataType accept a String. Sencerly i not sure if that's true !!!