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
165
Programmatically binding dropdown in RowEditTemplate
posted

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.

 

Parents
  • 25
    posted

    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();

          

Reply Children