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
332
Data dependent DropDownList
posted

Hello

I am trying to bind a DropDownList to a Column / Cell in a UltraWebGrid. This is very easy. I put the following Code in the InitializeLayout Eventhandler:

 e.Layout.Bands[0].Columns.FromKey("MyColumn").ValueList.ValueMember = "ValueField";
 e.Layout.Bands[0].Columns.FromKey("MyColumn").ValueList.DisplayMember = "TextField";
 e.Layout.Bands[0].Columns.FromKey("MyColumn").ValueList.DataSource = MyDataSource;
 e.Layout.Bands[0].Columns.FromKey("MyColumn").ValueList.DataBind();

This works fine. But it is not what I want. I want to bind the Data of the DropDownList dynamicaly depending on the corresponding record in the Grid. So every Row has its own Datas in the DropDownList, depending on the Row's Data.

Can anyone help me how to do this.  Thanks

 

Parents
  • 28464
    posted

    Hello,

    I think for this type of functionality, you can use templated columns and add asp:DropDownList inside the CellTemplate template. Then, in the InitializeRow event (not InitliazeLayout), you can find a reference to the respective asp:DropDownList and databind it directly to different datasources based on the row currently being bound.

    I believe there is a pretty good example how this can be achieved (InitializeRow, find a control inside CellTemplate and change its properties/bind it) in the following forum thread:

    http://forums.infragistics.com/forums/t/18700.aspx

Reply Children