Hi!
I have a grid with Row Adding enabled. I have defined DropDownProviders to some columns. What I haven't been able to implement is a way to get values from other dropdowns on the page as default values of the Insertion Row dropdowns. Here's the detailed explanation of the situation:
- I have dropdown on my page which binds to a datasource (say _ddProject)
- I have databound grid with Project as one column
- I have DropDownProvider in the Insertion Row which uses the same datasource than _ddProject
How can I use the _ddProject.SelectedValue as the selected value of Insertion Row dropdown?
Hello AriV,
In the RowAdding client side event you can set the inner text of the cell's element of the row add record:
function WebDataGrid1_RowAdding_EnteringEditMode(sender, eventArgs){ ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CancelEditModeEventArgs"></param> eventArgs.getCell().get_element().innerText = 'Hello 2';}
eventArgs.getCell().get_element().innerText = 'Hello 2';}
Let me know if you have any questions with this matter. Thank you.
Your solution seems to have everything to do with row editing where you already have data, but I am talking about insert row which (of course) doesn't have data bound to it. I know how to get data bound to the dropdowns on insert row, but this far I have failed to actually SELECT anything from the dropdowns.
I am doing at the moment the selection on code behind in DataBinding and just in case in PreRender event. If I check out the values in the Provider I see clearly that something has been selected.
SelectedItem: {Foobar}SelectedItemIndex: 3SelectedItems: Count = 1SelectedValue: "Foobar"Sort: "name"TextField: "name"ValueDisplayType: SimpleValueField: "name"
There is no selection on dropdown on the interface, but if I set the tooltip to be the SelectedValue I can see that on interface.
What are my options? Set the default value on client side?
The current value is automatically set to the editor control of the DropDownProvider for each cell. When using "<% =" and "%>" is for getting a particular field in the datasource databind to however the grid will automatically set the current value of the dropdown.
I attached a sample for this in particular.
Dropdowns have CurrentValue, but I haven't been able to set it by using code like this:
<ig:DropDownProvider ID="BranchProvider">
<EditorControl EnableDropDownAsChild="False" DataSourceID="SqlDataSource" TextField="name" ValueField="name" CurrentValue='<%= _dropdown.SelectedValue %>'>
<DropDownItemBinding TextField="name" ValueField="name"/>
</EditorControl>
</ig:DropDownProvider>
Is it possible to set the CurrentValue to match a value of a control somewhere on your page or do I have to do this on client side on TemplateOpened event?