How do I filter values of an Unbound WebCombo in a WebGrid?

9 replies. Last post: May 28, 2013 9:54 PM by Hans Kristian
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

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:

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/


How do I filter the List Items in the Unbound WebCombo?

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

is selected it does not filter and on subsequent rows selected nothing is in the Drop Down List.

I modified the code Hans supplied with:

<ClientSideEvents
	OnEnterEditMode="WebGrid1_OnEnterEditMode"
/>
<script language="javascript" type="text/javascript">

	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] = " + FilterValue_String);
			}
			else
			{
				switch (EmployeeID_String)
				{
					case "1":
						FilterValue_String = "Research Staff";
						break;
					default:
						FilterValue_String = "Research Manager";
				}
				_WebCombo.SetAdditionalFilters("[RoleName] = " + "'" + FilterValue_String + "'");
			}
			_WebCombo.SetText(_WebGridCell.Text, true);
		}
		return true;
	}

</script>

Please see attached screenshots and code.

Thanks,

Doug

 

All times are GMT -5. The time now is 8:43 AM.
Previous Next