﻿<?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 - DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</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>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Wed, 17 Feb 2010 23:13:24 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;The OPTGROUP is used to grouped options in the SELECT HTML element and by default is not selectable. You could read more about OPTGROUP in this &lt;a target="_blank" href="http://w3schools.com/tags/tag_optgroup.asp"&gt;page&lt;/a&gt; &lt;/p&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Wed, 17 Feb 2010 07:23:27 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;The problem is the '--- PLEASE SELECT ---', the OPTGROUP, can not be selected.&lt;/p&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Tue, 16 Feb 2010 21:32:24 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Attached is the sample I used to test the OPTGROUP and DroDownList item select upon entering WebGrid edit mode. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;My test show the code will run without any issue. The &lt;em&gt;Undecided&lt;/em&gt; option will be initially selected upon entering the cell for the first time.&lt;/p&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Mon, 15 Feb 2010 08:18:31 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The problem has nothing to do with wiring up the event.&lt;/p&gt;
&lt;p&gt;The code you initially provided in the other thread used a OPTGROUP and does not work with this code.&lt;br /&gt;&lt;br /&gt;The code you just provided in the other thread uses a OPTION and does work with this code.&lt;br /&gt;&lt;br /&gt;If you re-test this code with the OPTGROUP code you will find it does not work.&lt;/p&gt;
&lt;p&gt;Doug&lt;/p&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Sun, 14 Feb 2010 22:18:00 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>In this &lt;a target="_blank" href="../How-do-I-Insert-a-ListItem-into-a-DropDownList/"&gt;thread&lt;/a&gt;, you mention that the snippet could not set the SelectedIndex of the ASP DropDownList in IE. &lt;br /&gt;&lt;br /&gt;I have re-tested this snippet in IE and it works without any issue on my environment. &lt;br /&gt;&lt;br /&gt;Perhaps, I did not explain clearly in my first post, however this workaround will require you to handle the EnterEditMode WebGrid client side event. Here is the snippet showing EnterEditMode handler set to the WebGrid:&lt;br /&gt;&lt;pre&gt;&amp;lt;ISWebGrid:WebGrid ID="_WebGrid" runat="server"&amp;gt;&lt;br /&gt;    &amp;lt;LayoutSettings&amp;gt;&lt;br /&gt;        &amp;lt;ClientSideEvents OnEnterEditMode="_WebGrid_OnEnterEditMode" /&amp;gt;&lt;br /&gt;    &amp;lt;/LayoutSettings&amp;gt;&lt;br /&gt;	...&lt;br /&gt;&amp;lt;/ISWebGrid:WebGrid&amp;gt;&lt;/pre&gt;This workaround works by setting the selected index of the DropDownList which has the same value as the cell value.&lt;br /&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Mon, 08 Feb 2010 22:13:28 GMT</pubDate><dc:creator>Glayaar</dc:creator><description>&lt;p&gt;Thank you for the page sample. I have replicate the issue in my environment. The behavior in IE could be corrected using this workaround:&lt;/p&gt;&lt;pre&gt;function _WebGrid_OnEnterEditMode(controlId, tblName, editObject) &lt;br /&gt;{    &lt;br /&gt;	var _WebGrid = ISGetObject(controlId);&lt;br /&gt;&lt;br /&gt;	var cellObj = editObject.ToCellObject();&lt;br /&gt;&lt;br /&gt;	if (cellObj.Name == "Priority_WebGridColumn") {&lt;br /&gt;	    var selIndex = editObject.element.length - 1;&lt;br /&gt;	    for (var i = 0; i &amp;lt; editObject.element.length; i&amp;#43;&amp;#43;) {&lt;br /&gt;	        if (editObject.element.options[i].value == cellObj.Value) {&lt;br /&gt;	            selIndex = i;&lt;br /&gt;	            break;&lt;br /&gt;	        }&lt;br /&gt;	    }&lt;br /&gt;&lt;br /&gt;	    editObject.element.selectedIndex = selIndex;&lt;br /&gt;	}	&lt;br /&gt;	&lt;br /&gt;	return true;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;I have also inform the issue to our developer so it could be fixed in the future WebGrid release.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>DropDownList Default Value Not Selected in Edit Mode when using IE.</title><link>http://www.intersoftsolutions.com/Community/WebGrid/DropDownList-Default-Value-Not-Selected-in-Edit-Mode-when-using-IE/</link><pubDate>Mon, 08 Feb 2010 17:55:58 GMT</pubDate><dc:creator>DJBadin</dc:creator><description>&lt;p&gt;The &lt;span style="font-family: calibri; font-size: 15px"&gt;DropDownList Default Value is Not Selected in Edit Mode when using IE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;With the code below:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;- Display the page in IE 8&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;- Double Click the WebGrid Row 1, Column 1, Priority to change to Edit Mode&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;- A DropDown List is displayed however UNDECIDED is not selected&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;With other Browsers such as Mozilla it is selected&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;The stand alone DropDown List above the WebGrid has it selected&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;&lt;pre&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" %&amp;gt;

&amp;lt;%@ Import Namespace="System.Data" %&amp;gt;


&amp;lt;%@ Register assembly="ISNet.WebUI.WebGrid" namespace="ISNet.WebUI.WebGrid" tagprefix="ISWebGrid" %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;

&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;

&amp;lt;head runat="server"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
    
	&amp;lt;script runat="server"&amp;gt;
		
		protected void _WebGrid_InitializeLayout(object sender, LayoutEventArgs e)
		{
			ISNet.WebUI.WebGrid.WebValueList Priority_WebValueList = _WebGrid.GetTableByName("").Columns.GetNamedItem("Priority_WebGridColumn").ValueList;

			SortedList Priority_SortedList = new SortedList();

			Priority_SortedList.Add("ASSESS - 1", "1");
			Priority_SortedList.Add("ASSESS - 2", "2");
			Priority_SortedList.Add("ASSESS - 3", "3");
			Priority_SortedList.Add("DISPOSE", "D");
			Priority_SortedList.Add("UNDECIDED", "");

			Priority_WebValueList.DataSource = Priority_SortedList;
			Priority_WebValueList.DataTextField = "Key";
			Priority_WebValueList.DataValueField = "Value";

			RefurbPriority_DropDownList.DataSource = Priority_SortedList;
			RefurbPriority_DropDownList.DataTextField = "Key";
			RefurbPriority_DropDownList.DataValueField = "Value";

			RefurbPriority_DropDownList.SelectedValue = "";

			RefurbPriority_DropDownList.DataBind();
		}


		protected void Company_DropDownList_PreRender(object sender, EventArgs e)
		{
			DropDownList _DropDownList = (DropDownList) sender;
			_DropDownList.Items.Insert(0, "--- PLEASE SELECT ---");
		}
				
	&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
    &amp;lt;form id="form1" runat="server"&amp;gt;
    &amp;lt;div&amp;gt;

	&amp;lt;table&amp;gt;
		&amp;lt;tr&amp;gt;
			&amp;lt;td&amp;gt;PRIORITY&amp;lt;/td&amp;gt;
			&amp;lt;td&amp;gt;COMPANY&amp;lt;/td&amp;gt;
		&amp;lt;/tr&amp;gt;
		&amp;lt;tr&amp;gt;
			&amp;lt;td&amp;gt;
				&amp;lt;ASP:DROPDOWNLIST 
					ID="RefurbPriority_DropDownList" 
					runat="server"
				&amp;gt;
				&amp;lt;/ASP:DROPDOWNLIST&amp;gt;
			&amp;lt;/td&amp;gt;
			&amp;lt;td&amp;gt;
				&amp;lt;ASP:DROPDOWNLIST 
					ID="Company_DropDownList" 
					runat="server" 
					DataValueField="CustomerID"
					DataTextField="CompanyName"
					DataSourceID="Company_SqlDataSource"
					onPreRender="Company_DropDownList_PreRender"
				&amp;gt;
				&amp;lt;/ASP:DROPDOWNLIST&amp;gt;
				
			&amp;lt;/td&amp;gt;
		&amp;lt;/tr&amp;gt;
		&amp;lt;tr&amp;gt;
			&amp;lt;td colspan="2"&amp;gt;
				&amp;lt;ISWebGrid:WebGrid 
					ID="_WebGrid"
					runat="server"
					DataSourceID="Orders_SqlDataSource"
					Height="250px"
					UseDefaultStyle="True"
					DefaultStyleMode="Win7"
					OnInitializeLayout="_WebGrid_InitializeLayout"
				&amp;gt;
					&amp;lt;LayoutSettings
						AllowEdit="Yes"
						AllowSorting="Yes"
						AllowBatchUpdate="true"
					&amp;gt;
						&amp;lt;BatchUpdateSettings
							AllowReviewChanges="true"
							AutomaticObjectUpdate="false"
						/&amp;gt;
					&amp;lt;/LayoutSettings&amp;gt;
					&amp;lt;RootTable
						DataKeyField="OrderID"
					&amp;gt;
						&amp;lt;Columns&amp;gt;
							&amp;lt;ISWebGrid:WebGridColumn
								Name="Priority_WebGridColumn"
								Bound="True"
								DataMember="REFURB_PRIORITY"
								EditType="DropdownList"
								Caption="PRIORITY"
								Width="100px"
								NullText=""
								DefaultValue=""
								InputRequired="true"
								InputRequiredErrorText="Priority Needed"
							&amp;gt;
							&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
							&amp;lt;ISWebGrid:WebGridColumn
								Name="Company_WebGridColumn"
								Bound="True"
								EditType="DropdownList"
								Caption="Company"
								Width="100px"
								InputRequired="false"
							&amp;gt;
								&amp;lt;ValueList
									DataSourceID="Company_SqlDataSource"
									DataTextField="CompanyName"
									DataValueField="CustomerID"
								&amp;gt;
								&amp;lt;/ValueList&amp;gt;
								&amp;lt;CellStyle BackColor="Yellow"/&amp;gt;
							&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;
							&amp;lt;ISWebGrid:WebGridColumn
								Caption="Order ID"
								EditType="NoEdit"
								DataMember="OrderID"
								Name="OrderID_WebGridColumn"
								Width="100px"
							&amp;gt;
								&amp;lt;CellStyle ForeColor="Black"/&amp;gt;
							&amp;lt;/ISWebGrid:WebGridColumn&amp;gt;

						&amp;lt;/Columns&amp;gt;
					&amp;lt;/RootTable&amp;gt;
				&amp;lt;/ISWebGrid:WebGrid&amp;gt;
				&amp;lt;/td&amp;gt;
		&amp;lt;/tr&amp;gt;
	&amp;lt;/table&amp;gt;
	
	&amp;lt;asp:SqlDataSource
		ID="Company_SqlDataSource"
		runat="server"
		ConnectionString="&amp;lt;%$ ConnectionStrings:NorthwindConnectionString2005 %&amp;gt;"
		SelectCommand="SELECT [CustomerID], [CompanyName] FROM [Customers] ORDER BY [CustomerID]"
	&amp;gt;&amp;lt;/asp:SqlDataSource&amp;gt;

	&amp;lt;asp:SqlDataSource
		ID="Orders_SqlDataSource"
		runat="server"
		ConnectionString="&amp;lt;%$ ConnectionStrings:NorthwindConnectionString2005 %&amp;gt;"
		SelectCommand="SELECT TOP 5 [OrderID], [CustomerID], '' AS REFURB_PRIORITY, '' AS GRAPHICS_NEW FROM [Orders] ORDER BY [OrderID]"
	&amp;gt;&amp;lt;/asp:SqlDataSource&amp;gt;

    &amp;lt;/div&amp;gt;
    &amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;/span&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: calibri; font-size: 15px"&gt;&lt;/span&gt; &lt;/p&gt;</description></item></channel></rss>