In an effort to seperate the UI from the database access, I have been trying to remove the database specifics from my web form by using seperate access classes returning relavent datasets. For the most part this has worked except for a slight problem.
By using a SQL Data Source, I am able to bind a dropdown within a rowedittemplate to a table that maps the numerical id's to the proper display names, and it works correctly, but I have not figured out a way to do this programmatically. Basically I am trying to bind the dropdown located inside Row Edit Template to a dataset, but the drop down is not identified as a control in the code behind for the page. Any help would be greatly appreciated.
Thank you both very much, this looks like exactly what I was looking for.
Yes, that is a great approach, but I would recommend using the FindControl method to locate the dropdown instead of hardcoding the child controls in code, since the code will need to be changed if you modify the HTML appearance of the RowEditTemplate.
Example:
(DropDownList)UltraWebGrid1.Bands(0).RowEditItem.FindControl("DropDownList1")
More info can be found in this blog post:
Infragistics Ultra Web Grid: Accessing a control from a RowEditTemplate
http://geekswithblogs.net/dlussier/archive/2007/07/19/114065.aspx
if i understand what you need :
this is in my InitializeLayout
DropDownList myList = (DropDownList)UltraGrid.Bands[0].RowEditItem.Controls[1].Controls[2].Controls[1].Controls[1]; myList.Items.Clear(); myList.DataSource = myListItems.GetDataList(myListItems.AvailableLists.Venues).myListItemDataTable; myList.DataTextField = "myListItemText"; myList.DataValueField = "myListItemRank"; myList.DataBind();