Discussion:
HtmlSelect not Binding
Brady Kelly
2007-04-27 16:24:31 UTC
Permalink
I have an HtmlSelect control that I dynamically add to a Repeater row (I
build each row in ItemDataBound). I set data binding properties as follows,
but when the drop down renders it is still empty. Why could this be?



HtmlSelect select = new HtmlSelect();

select.Value = dataValue.ToString();

select.DataSource = this.MyController.WorkTypeList;

select.DataValueField = "WorkTypeID";

select.DataTextField = "WorkType";

gridCell.Controls.Add(select);


===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Brad Wilson
2007-04-27 16:54:43 UTC
Permalink
Call select.DataBind().
Post by Brady Kelly
I have an HtmlSelect control that I dynamically add to a Repeater row (I
build each row in ItemDataBound). I set data binding properties as follows,
but when the drop down renders it is still empty. Why could this be?
HtmlSelect select = new HtmlSelect();
select.Value = dataValue.ToString();
select.DataSource = this.MyController.WorkTypeList
;
select.DataValueField = "WorkTypeID";
select.DataTextField = "WorkType";
gridCell.Controls.Add(select);
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
--
http://www.agileprogrammer.com/dotnetguy/
http://www.flickr.com/photos/dotnetguy/

===================================
This list is hosted by DevelopMentor� http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
Loading...