I would like to populate a column's drop down provider with table data based on another column's value in the same row. Is this possible?
Hi,
Let me know if you have any questions with this.
Thanks.
Will this concept work with two SQL data sources?
Yes It should.
Just download the attached sample adjust the references to match your own. Also ig_res folder is needed to be added to the project since I've removed it due to space upload limitation.
Thanks
Do you happen to have a sample in VB instead of C#?
Acctualy I don't have a sample in vb I've built it particularly for this scenario. You could convert it easily to vb. There are so many free converters out there.
Hope this helps.
I was able to convert most of what you did to the VB.NET that we are using. The problem we have is with the OnItemsRequested.
We are creating the provider dynamically and the OnItemsRequested Event is set to Protected Friend. As a result it will not allow us to add the event handler for the eProvider_ItemsRequested method using AddHandler and since it is dynamic, we cannot use "Handles MyDynamicallyCreatedProvider.OnItemsRequested" since it is there only at runtime. How can we plug that in using VB.NET? Btw we are using 11v1 build 2116, in case there is a difference in how things are handled than the original 10.2 used.
Additionally the control that will cause this change (first column/cell) may not be a dropdown (could be a calendar control or a text field).
Thanks!
Rado, very cool bit of coding there... Nice work
I suppose this is because I have hard coded the IDs of the controls. Okay, I have made some changes on the sample to make it work. Register Initialize - client - side handlers:
<ig:DropDownProvider ID="WebDataGrid1_DropDownProvider1">
<EditorControl DropDownContainerMaxHeight="200px" EnableAnimations="False" ID="provider1"
runat="server" EnableDropDownAsChild="False" DropDownContainerWidth="150px">
<Items>
<ig:DropDownItem Key="ASP" Text="ASP" Value="1">
</ig:DropDownItem>
<ig:DropDownItem Key="PHP" Text="PHP" Value="2">
<ig:DropDownItem Key="JAVA" Text="JAVA" Value="3">
</Items>
<ClientEvents Initialize="InitializeEditorProvider1" />
<Button AltText="" />
</EditorControl>
</ig:DropDownProvider>
The same is for the second dropdownprovider .
The code is:
<script type="text/javascript">
var provider_id1;
var provider_id2;
function loadDropDownItems(sender, args) {
var previousCell;
try {
previousCell = args._cell._row.get_cell(args._cell.get_index() - 1);
} catch (e) { }
//'ContentPlaceHolder1_WebDataGrid1_provider2'
if (args._editor._id == provider_id2.get_id()) {
args._editor.loadItems(previousCell.get_text());
}
function InitializeEditorProvider1(sender, args) {
provider_id1 = sender;
function InitializeEditorProvider2(sender, args) {
provider_id2 = sender;
</script>
Hi Rado
I downloaded your provided sample but its not working properly.
The java script function
try{
}catch(e){}
if (args._editor._id == 'WebDataGrid1_provider2') {
is not working properly. the code portion which i have made bold never runs. compiler did'nt find any editor with the id.
One more thing it is just about editing rows. I want the same for row adding. Kindly help me out with example as you provided before.