Hi,
I'm trying to create a parent-child relation between two dropdownlists in two ultragrid columns. The webgrid is bound to a list of objects.
For example: one dropdownlist that contrains carbrands and a second that will contain the cars that are made by the selected brand in the first list. The complication is that both these dropdownlists are bound to the dataobject. (Because the object can both be bound to a specific car type or just a brand type.)
First i tried to do this with valuelists, but it seems that a valuelist has no 'selectedindexchanged' event or something like that. Therefore i cant trigger the second valuelist to rebind to his datasource. Is this possible in any way?
Next i tried to use templatecolumns, like this: (removed some of the markup code for visibility)
<igtbl:TemplatedColumn blablabla<CellTemplate><asp:DropDownList DataSourceID="odsCarBrands" SelectedValue='<%#DataBinder.Eval(Container.DataItem,"Car_Brand_Id")%>' DataTextField="Type" DataValueField="Car_Brand_Id" ID="ddlCarBrand" runat="server" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlCarBrand_SelectedIndexChanged" /> </igtbl:TemplatedColumn><igtbl:TemplatedColumn blablabla<CellTemplate><asp:DropDownList SelectedValue='<%#DataBinder.Eval(Container.DataItem,"Car_Id")%>' DataSourceID="odsCars" DataTextField="Name" DataValueField="Car_Id" ID="ddlCar" runat="server" AppendDataBoundItems="true"><asp:ListItem Value=""></asp:ListItem></asp:DropDownList><asp:ObjectDataSource ID="odsCars" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetCarsByBrand" TypeName="Car" ><SelectParameters><asp:Parameter Name="BrandId" Type="Int32" DefaultValue="-1" /></SelectParameters></asp:ObjectDataSource></CellTemplate></igtbl:TemplatedColumn>
In the codebehind i handle the selectedindexchanged event by changing the objectdatasource's parameter and databinding the second dropdownlist. This is not very handy but it works a little bit. The problem is: when im trying to update the item i get errors like these:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
I'm familiair with there errors because they happen in detailviews as well when you have databound controls in databound controls. Its pretty much impossible to fix this without losing the automatic databinding.
Has anyone tried to do something like this before? Is there some easy way for this i'm overlooking? I cant imagine its this hard with an ultrawebgrid..
I'm very interested in any ideas about this..
Tim
Hi Petar,
I am very new to Infragistics control.
I have similar requirement where I need to create a ultragrid within which two dropdownlists will be there.
And changing one dropdownlist another dropdown list will be populated accordingly based upon first dropdown values.
Please help me with an complete code example.
This is urgent
Thanks,
Hi all,
Please feel free to contact me if you need further assistance.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support
Hi Dev__01,
CSOM documentation is avaialable for our controls. The documentation can be accessed at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/
The client side documentation for the WebCombo in particular, can be found at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=WebCombo_Client_Side_Programming.html
Please let me know if I can be of further assistance.
Hi Peter:
Yes - this helped very much. It eliminates all of the complexity of dynamically populating the combo boxes.
One question I also have is - does a general reference guide for the Infragistics Client-Side API exist?
Thank you!
Apologies for the delayed response.
@ PrachiJain,
In the selectedRowChange handler you can find the index of the (first) selected row using:
e.SelectedRows[0].Index
@ Dev__01
If for all your rows you have a "global" list of all the possible options/values, I can suggest that you handle the BeforeDropDown client-side event of the WebCombo. In the handler function you can hide or show the rows based on your requirements. That way the values for your other rows should not be changed.
You can hide a row in the WebCombo's grid on the client by using for example:
igcmbo_getComboById("WebCombo1").grid.Rows.getRow(1).setHidden(true)
Please tell me if this helps.
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://es.infragistics.com/support