﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Change DropDownList DataSource on AddRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Change-DropDownList-DataSource-on-AddRow/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Change DropDownList DataSource on AddRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Change-DropDownList-DataSource-on-AddRow/</link><pubDate>Thu, 08 Apr 2010 22:59:56 GMT</pubDate><dc:creator>Glayaar</dc:creator><category>WebGrid</category><description>&lt;p&gt;For your scenario, my suggestion would be inline with your solution. We must manually remove and add the new option during OnEnterEditMode client side event handler.&lt;/p&gt;&lt;p&gt;On the other hand, if you are using WebCombo, you could try using SetAdditionalFilter method to filter the data based on certain criteria as detailed in the WebCombo documentaion on article titled "&lt;em&gt;&lt;span id="pagetitle"&gt;How-to: Filter the data in WebCombo using SetAdditionalFilter 
method&lt;/span&gt;&lt;/em&gt;"&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Change DropDownList DataSource on AddRow</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Change-DropDownList-DataSource-on-AddRow/</link><pubDate>Thu, 08 Apr 2010 18:30:32 GMT</pubDate><dc:creator>Gmontes</dc:creator><category>WebGrid</category><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I found a way to do this, but I don't know if there's another approach to this.&lt;/p&gt;
&lt;p&gt;I have a Grid with a DropdownList column (not WebCombo) and I need to swap the datasource for that column when adding a new row. Existing records need to display their corresponding text from the assigned datasource, but when adding I need the dropdown to point to another datasource... or simply use another dropdown editor hidden on the form. &lt;/p&gt;
&lt;p&gt;Basically, every entry on the datasource can be displayed for that column, but only a few may be added (based on permissions, etc). I'm doing this with the OnEnterEditMode method:&lt;/p&gt;
&lt;p /&gt;&lt;pre&gt;function webGridBeta_OnEnterEditMode(controlId, tblName, editObject) {
        if (editObject.ToCellObject().Name == "Status") {
            debugger;
            var editObj = editObject.element.value;
            var options = editObject.element.getElementsByTagName('option');
            var optionsLength = editObject.element.getElementsByTagName('option').length;
            optionsBackup = options;
            var ddlTemp = $get('&amp;lt;%=ddlStatusSwap.ClientID%&amp;gt;');
            var ddlOptions = ddlTemp.getElementsByTagName('option');
            var ddlOptionsLength = ddlTemp.getElementsByTagName('option').length;
            editObject.element.removeChild(options[2]);
            editObject.element.removeChild(options[1]);
            editObject.element.removeChild(options[0]);
            editObject.element.appendChild(ddlOptions[1]);
            editObject.element.appendChild(ddlOptions[0]);            
        }    
    }&lt;/pre&gt;
&lt;p&gt; This ddlStatusSwap is being populated on Page_Load and I'm just moving its &amp;lt;Option&amp;gt; nodes to the dropdown the grid generates as I purge the "old" ones.&lt;/p&gt;
&lt;p /&gt;
&lt;p&gt;Is there a more efficient approach?&lt;/p&gt;</description></item></channel></rss>