﻿<?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 - How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</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>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Tue, 28 May 2013 21:54:33 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I am really happy to hear that the workaround works for your current scenario.&lt;br /&gt;Thank you very much.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Tue, 28 May 2013 16:51:26 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is working for me.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Mon, 27 May 2013 02:58:08 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I made a workaround to get “DepartmentId” value that you might try.&lt;br /&gt;I set the ComboMode to “MultipleColumns” and I add “DepartmentId” column to WebCombo as well.&lt;br /&gt;In OnEnterEditMode client side event, I add a couple line of code the get the “DepartmentId” value.&lt;br /&gt;&lt;br /&gt;Please kindly have review on the modified sample to see the result.&lt;br /&gt;&lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Thu, 23 May 2013 14:43:28 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;One problem with the code is eventually with different values it displays nothing which can be corrected by setting the values to display with style.display = "inline".&lt;/p&gt;&lt;pre&gt;if (RowValue != WebComboValue)
{
	Row.RowElement.style.display = "none";
}
else
{
	Row.RowElement.style.display = "inline";
}

&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Now the next step is I want to filter based on the [Roles].[DepartmentId] column.&lt;/p&gt;
&lt;p&gt;1. It probably needs to be added to the SqlDataSource2 SelectCommand.&lt;/p&gt;&lt;pre&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="&amp;lt;%$ ConnectionStrings:SqlSampleConnection %&amp;gt;"
    SelectCommand="SELECT [RoleId], [RoleName], [DepartmentId] FROM [Roles]"&amp;gt;&amp;lt;/asp:SqlDataSource&amp;gt;
&lt;/pre&gt;

&lt;p&gt;2. I do not want [Roles].[DepartmentId] to be displayed as a column in the DropDown&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;How do I reference the [Roles].[DepartmentId] Value in the OnEnterEditMode Event so I can Filter by it?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Tue, 21 May 2013 17:33:26 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hi Hans,&lt;/p&gt;
&lt;p&gt;I will try it and let you know the results.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Tue, 21 May 2013 02:17:16 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I apologize for keep you waiting.&lt;br /&gt;&lt;br /&gt;Basically, The SetAdditionalFilters() method can’t be used in Unbound WebCombo indeed. So it will make the issue occurs.&lt;br /&gt;&lt;br /&gt;However, I have a workaround that you might try. I modified your validation code in OnEnterEditMode WebGrid’s client side event.&lt;br /&gt;In that event, I try to get all rows in WebCombo result box and then I try to hide the row that doesn’t have the same value with WebCombo value.&lt;br /&gt;&lt;br /&gt;Here’s the example snippet validation code:&lt;br /&gt;&lt;pre&gt;function WebGrid1_OnEnterEditMode(controlId, TableName, editObject) {    var _WebGrid = ISGetObject(controlId);
    var _WebGridCell = editObject.ToCellObject();
    if (_WebGridCell.Name == "Roles") {
        var _WebCombo = editObject.element;
                
        //So I can get WebCombo rows
        _WebCombo.ShowDropDown(); 
                
        window.setTimeout(function () {
            //To get WebCombo value
            var WebComboValue = _WebCombo.Values[0].Value; 
            //To get WebCombo rows
            var WebComboRows = _WebCombo.GetRows();
            var RowsLength = WebComboRows.length;
                    
            for (i = 0; i &amp;lt; RowsLength; i&amp;#43;&amp;#43;) {
                var Row = WebComboRows[i];
                var RowValue = Row.Value;
                        
                if (RowValue != WebComboValue)
                    Row.RowElement.style.display = "none";
            }
            //To hide the dropdown again
            _WebCombo.HideDropDown();
        }, 500);
    }
    return true;
}&lt;/pre&gt;
&lt;p&gt;I attached the modified sample as well. Hope this helps. &lt;br /&gt;Thank you.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;
</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Mon, 20 May 2013 06:51:42 GMT</pubDate><dc:creator>Hans</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Yes, currently we are still investigating your issue to find the right solution.&lt;br /&gt;I am sorry for the late response.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Sun, 19 May 2013 14:18:12 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Is your server still having problems?  (Other people are getting responses.)&lt;/p&gt;
&lt;p&gt;Since you already replied about server problems, does that mean I dropped out of your To Do queue?&lt;/p&gt;
&lt;p&gt;Have you done any investigation prior to this reply?&lt;/p&gt;
&lt;p&gt;Please respond.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Thu, 16 May 2013 06:02:05 GMT</pubDate><dc:creator>Hans</dc:creator><description>Hello,&lt;br /&gt;&lt;br /&gt;I am truly sorry for the late response. Currently we had some problems in our server.&lt;br /&gt;&lt;br /&gt;Thank you for your information and code.&lt;br /&gt;&lt;br /&gt;I will investigate code and I will let you know about the result regarding this problem.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Hans.</description></item><item><title>How do I filter values of an Unbound WebCombo in a WebGrid?</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-do-I-filter-values-of-an-Unbound-WebCombo-in-a-WebGrid/</link><pubDate>Wed, 15 May 2013 14:51:21 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I replied to a posting that was answered and could not figure out how to un-answer it to make sure Support would look at it so I created this post.  Please refer to:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.intersoftpt.com/Community/WebGrid/How-do-I-set-multiple-values-for-an-Unbound-WebCombo-in-a-WebGrid-to-show-up-in-the-DropDown/"&gt;http://www.intersoftpt.com/Community/WebGrid/How-do-I-set-multiple-values-for-an-Unbound-WebCombo-in-a-WebGrid-to-show-up-in-the-DropDown/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;How do I filter the List Items in the Unbound WebCombo?&lt;/p&gt;
&lt;p&gt;I tried to use the WebCombo Client Side Method SetAdditionalFilters in the WebGrid ClientSideEvent OnEnterEditMode based on a value in the row but on the first time a row &lt;/p&gt;
&lt;p&gt;is selected it does not filter and on subsequent rows selected nothing is in the Drop Down List.&lt;/p&gt;
&lt;p&gt;I modified the code Hans supplied with:&lt;/p&gt;&lt;pre&gt;&amp;lt;ClientSideEvents
	OnEnterEditMode="WebGrid1_OnEnterEditMode"
/&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;

	function WebGrid1_OnEnterEditMode(controlId, TableName, editObject)
	{
		var _WebGrid = ISGetObject(controlId);
		var _WebGridCell = editObject.ToCellObject();
		if (_WebGridCell.Name == "Roles")
		{
			var _WebCombo = editObject.element;
			var FilterValue_String ;
			var EmployeeID_String = _WebGridCell.Row.GetCell("EmployeeID").Value
			if (true)
			{
				switch (EmployeeID_String)
				{
					case "1":
						FilterValue_String = "1";
						break;
					default:
						FilterValue_String = "2";
				} 
				_WebCombo.SetAdditionalFilters("[RoleId] = " &amp;#43; FilterValue_String);
			}
			else
			{
				switch (EmployeeID_String)
				{
					case "1":
						FilterValue_String = "Research Staff";
						break;
					default:
						FilterValue_String = "Research Manager";
				}
				_WebCombo.SetAdditionalFilters("[RoleName] = " &amp;#43; "'" &amp;#43; FilterValue_String &amp;#43; "'");
			}
			_WebCombo.SetText(_WebGridCell.Text, true);
		}
		return true;
	}

&amp;lt;/script&amp;gt;
&lt;/pre&gt;


&lt;p&gt;Please see attached screenshots and code.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Doug&lt;br /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description></item></channel></rss>