Hello,
I'm using dropDownProvider in whdg. I want to bind ddp to datasource, which is dataview (to be exact, to one of the columns of DataTable from DataSource). For ultrawebgrid it could be done like this
UltraWebGrid1.Columns[2].Type = ColumnType.DropDownList;UltraWebGrid1.Columns[2].ValueList.DataSource = dv;UltraWebGrid1.Columns[2].ValueList.DisplayMember = "Name";UltraWebGrid1.Columns[2].ValueList.ValueMember = "Name";UltraWebGrid1.Columns[2].ValueList.DataBind();
I tried this
this.DropDownProvider1.EditorControl.DataSource = dv; this.DropDownProvider1.EditorControl.DataMember = "Name"; this.DropDownProvider1.EditorControl.DataBind();
But it throws "System.InvalidOperationException" exception on DataBind(). I also tried ValueField instead of DataMember, but then it displays empty strings
Hi Andrey,
I would suggest you to get the editor and set data source like this:
WebDropDown editor = (WebDropDown)WebHierarchicalDataGrid1.EditorProviders["DropDownProvider1"].GetEditor(); editor.DataSource = dv; editor.DataMember = "Name";
Let me know if this helps.
Hello Nikolay,
Unfortunately, nothing changed. I include the sample solution.
Hello Andrey,
You don't need to set DataMember since you are using DataView for a datasource. You should set TextField and ValueField. for example:
MakeParentTable();DataView dv = dataSet.Tables["ParentTable"].DefaultView;WebDropDown1.DataSource = dv;WebDropDown1.TextField = "ParentItem";WebDropDown1.ValueField = "id";
Hope this helps.
Thanks, nice!
I'm glad I could help.
Let me know if you have further questions.
Hi Nikolay,
Yes, unfortunately I have - http://es.infragistics.com/community/forums/p/74746/377868.aspx#377868