<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tag 'DropDownList'</title><link>http://forums.asp.net/search/SearchResults.aspx?q=&amp;tag=DropDownList&amp;orTags=0&amp;o=DateDescending</link><description>Search results matching tag 'DropDownList'</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>i can't access my list box</title><link>http://forums.asp.net/thread/3580234.aspx</link><pubDate>Wed, 23 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3580234</guid><dc:creator>sumeshss</dc:creator><description>&lt;p&gt;i have added some values to my asp listbox control from javascript.it is visible on browser too.but while i am accessing it using c# code (count attribute),&lt;/p&gt;&lt;p&gt;it shows count value as zero.can any body help me?&lt;/p&gt;</description></item><item><title>Passing parameters from View to Controller</title><link>http://forums.asp.net/thread/3581152.aspx</link><pubDate>Wed, 23 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3581152</guid><dc:creator>BrianFan</dc:creator><description>&lt;p&gt;How do you pass values from a&amp;nbsp;View to a Controller?&amp;nbsp; I have an Html.DropDownList&amp;nbsp;in a view, and need to get the selected value/text back to the controller.&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt; &amp;lt;% using (Html.BeginForm(&amp;quot;FileUpload&amp;quot;, &amp;quot;Admin&amp;quot;, 
                    FormMethod.Post, new { enctype = &amp;quot;multipart/form-data&amp;quot; }))
        {%&amp;gt;
        &amp;lt;div class=&amp;quot;padded&amp;quot;&amp;gt;&amp;lt;%= Html.DropDownList(&amp;quot;UploadOptions&amp;quot;) %&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;fieldset&amp;gt;
        &amp;lt;legend&amp;gt;Browse for a file&amp;lt;/legend&amp;gt;
        &amp;lt;input name=&amp;quot;uploadFile&amp;quot; type=&amp;quot;file&amp;quot; size=&amp;quot;40&amp;quot; /&amp;gt;
        &amp;lt;/fieldset&amp;gt;
        &amp;lt;hr /&amp;gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Upload File&amp;quot; /&amp;gt;
&amp;lt;%} %&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt; public class AdminController : Controller
    {
        bool _wasSuccess;
        //
        // GET: /Admin/

        public ActionResult Admin()
        {
            return View();
        }

        public ActionResult Success()
        {
            return View();
        }

        public ActionResult Error()
        {
            return View();
        }

        public ActionResult UploadData()
        {
            ViewData[&amp;quot;UploadOptions&amp;quot;] = new SelectList(new [] {&amp;quot;--Select A Document Type--&amp;quot;, &amp;quot;DDRT&amp;quot;, &amp;quot;AKZ&amp;quot;});
            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult FileUpload(HttpPostedFileBase uploadFile)
        {
            _wasSuccess = true;
            try
            {
                if (uploadFile.ContentLength &amp;gt; 0)
                {
                    string filePath = Path.Combine(HttpContext.Server.MapPath(&amp;quot;../Uploads&amp;quot;),
                        Path.GetFileName(uploadFile.FileName));
                    uploadFile.SaveAs(filePath);
                }
            }
            catch (Exception ex) { _wasSuccess = false; }

            if (_wasSuccess == true)
                return View(&amp;quot;Success&amp;quot;);
            else
                return View(&amp;quot;Error&amp;quot;);
        }
    }&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Displaying the SelectedItem as a Label / TextBox</title><link>http://forums.asp.net/thread/3574820.aspx</link><pubDate>Sun, 20 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3574820</guid><dc:creator>quentins</dc:creator><description>&lt;p&gt;In the ASCX I love the simplicity of the &lt;b&gt;Html.DropDownList(&amp;quot;&amp;quot;, ViewData[&amp;quot;Users&amp;quot;] as IEnumerable&amp;lt;SelectListItem&amp;gt;)&amp;nbsp;&lt;/b&gt; &lt;/p&gt;&lt;p&gt;and thhe use of the UIHint to select this.&amp;nbsp; But there are times I need to show this for display purposes such as in Grids or on a Read Only Display page.&amp;nbsp; In these cases it would be great if I could use the same approach to get the item, but if not what is the best approach to getting this text? &lt;/p&gt;&lt;p&gt;For reference I use this in my Controller to generate the list for thhe controller - ViewData[&amp;quot;Users&amp;quot;] = new SelectList(c_User.Items, &amp;quot;UserID&amp;quot;, &amp;quot;FullName&amp;quot;);&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Is there a way to do this so it can be used in a Label or a TextBox (I want to show the same data as would be in a DropDown for the SELECTED ITEM) but just not let the user edit it.&amp;nbsp; I could hard code this but that doesn&amp;#39;t seem the best approach as I have 2 (or more) cases where this is needed just for User Names.&amp;nbsp; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Tanks in advance for any help!&lt;br /&gt;&lt;/p&gt;</description></item><item><title>How to filter data in html dropdown lists</title><link>http://forums.asp.net/thread/3558686.aspx</link><pubDate>Thu, 10 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3558686</guid><dc:creator>cmakwana</dc:creator><description>&lt;p&gt;hi.&lt;/p&gt;&lt;p&gt;In my application on edit page i have three drop down lists for country,states and cities.&lt;/p&gt;&lt;p&gt;If i use cascading dropdown list for state and city then i am facing problem.&lt;/p&gt;&lt;p&gt;If user does chage Country from country&amp;#39;s dropdown list then dropdowns for state and city remains blank though it is edit page.&lt;/p&gt;&lt;p&gt;So what i want to do is ,i want to show values in all the dropdowns as user has submitted previously.&lt;/p&gt;&lt;p&gt;Another problem with cascading dropdown list is that,its selected value is lost if control comes to that page again after post.&lt;/p&gt;&lt;p&gt;please help me with this .&lt;/p&gt;&lt;p&gt;i m confused.&lt;/p&gt;&lt;p&gt;thanking in advance.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Disabling a Specific Column in Listview for Editing</title><link>http://forums.asp.net/thread/3557292.aspx</link><pubDate>Wed, 09 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3557292</guid><dc:creator>nencarnacion</dc:creator><description>&lt;p&gt;&amp;nbsp;I have a Listview and a dropdown list. The dropdown list contains all of the columns shown in the listview. What i want to do is that whenever i select an item from the dropdown list, the corresponding column in the listview will be disabled for editing. How do i do this guys?&lt;/p&gt;</description></item><item><title>CompositeControl - DropDownList and LinqDataSource.Selecting Issue</title><link>http://forums.asp.net/thread/3552603.aspx</link><pubDate>Mon, 07 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3552603</guid><dc:creator>azurfire</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;So I am creating a composite control. The idea is to have some dropdown lists that filter the results returned by the LinqDataSource.&lt;/p&gt;&lt;p&gt;Inside CreateChildControls(), I create the LinqDataSouce and the dropdown lists. If the page is not a postback, I add a &amp;quot;View All&amp;quot; item to the dropdown lists and then databind them to fill them with items from a database. Then I add WhereParameters (ControlParameters) to the LinqDataSource for each of the dropdown lists.&lt;/p&gt;&lt;p&gt;The problem is that when the LinqDataSource selects its items, the where parameters are all set to &amp;quot;View All&amp;quot; instead of what was selected. &lt;span class="Apple-style-span" style="text-decoration:underline;"&gt;I think the states of the dropdown lists are not being restored until after the LinqDataSource does the select.&lt;/span&gt;&amp;nbsp;If I check the state of the dropdown lists while the LinqDataSource is selecting, they are all empty. If I check at a later time, such as during PreRender(), all the dropdown lists have the correct items and selected values.&lt;/p&gt;&lt;p&gt;So does anyone know how to make sure the states of the dropdown lists are restored before the LinqDataSource selects?&lt;/p&gt;&lt;p&gt;Thank you.&lt;/p&gt;</description></item><item><title>Re: SelectedIndexChanged called when nothing changes...</title><link>http://forums.asp.net/thread/3548908.aspx</link><pubDate>Fri, 04 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3548908</guid><dc:creator>james_t</dc:creator><description>&lt;pre class="c-sharp" name="code"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Hi All!&lt;/p&gt;
&lt;p&gt;Can someone shed light on a similar problem here, hopefully&amp;nbsp;this trail is still active...&lt;/p&gt;
&lt;p&gt;I have 4 cascading dropdownlists (named ddlCountryID_edt, ddlProvinceID_edt, ddlCityID_edt, ddlSuburbID_edt) located in the EditTemplate of a FormView (named fmvEnterpriseDetails) &amp;nbsp;which in turn is located inside the ContentPlaceHolder derived from a masterpage.&lt;/p&gt;
&lt;p&gt;The 4 dropdownlists populate each other one after another in turn by means of AJAX service calls in a manner similar to the AJAX Sample Website Database Cascading DropdownLists.&lt;/p&gt;
&lt;p&gt;The problem is with the last one ddlSuburbID_edt. I needed to grab some values from the database based on selections in all 4 dropdowns, so i wired a SelectedIndexChanged handler to ddlSuburbID_edt and set both&amp;nbsp;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;EnableViewState and AutoPostBack to &amp;quot;true&amp;quot; on ddlSuburbID_edt. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;The SelectedIndexChanged fires as expected when i select a value in ddlSuburbID_edt. The problem is that the handler also fires when i click a button such as btnUpdate or btnCancel. How do i stop the event handler from firing when i click these buttons? I have also tried setting EnableViewState to true and to false in the ContentPlaceHolder tag to no avail. I have also set AutoEventWireUp to false in the page directive. Still no solution! By the way when i set EnableViewState on ddlSuburbID_edt to false, the selectedindexhandler doesnt fire anymore when an iten is selected in the dropdownlist!&lt;/p&gt;
&lt;p&gt;Here is a stripped down extrcat of my aspx page------&lt;/p&gt;&lt;pre class="xhtml" name="code"&gt;  &amp;lt;asp:FormView ID=&amp;quot;fmvEnterpriseDetails&amp;quot; runat=&amp;quot;server&amp;quot; 
        BorderColor=&amp;quot;#0099FF&amp;quot; BorderStyle=&amp;quot;Solid&amp;quot; 
        BorderWidth=&amp;quot;1px&amp;quot; DataSourceID=&amp;quot;odsEnterpriseDetails&amp;quot; Width=&amp;quot;100%&amp;quot; AllowPaging=&amp;quot;true&amp;quot; 
        DataKeyNames=&amp;quot;strEnterpriseID&amp;quot; 
        onitemcommand=&amp;quot;fmvEnterpriseDetails_ItemCommand&amp;quot; 
        onitemcreated=&amp;quot;fmvEnterpriseDetails_ItemCreated&amp;quot;&amp;gt;
        &amp;lt;EditItemTemplate&amp;gt;
                &amp;lt;table width=&amp;quot;100%&amp;quot;&amp;gt;
                     &amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;&amp;lt;asp:Label ID=&amp;quot;lblCountryID_edt&amp;quot; runat =&amp;quot;server&amp;quot; Text = &amp;quot;Country:&amp;quot;/&amp;gt; &amp;lt;/td&amp;gt;
                        &amp;lt;td&amp;gt;
                        &amp;lt;asp:DropDownList ID=&amp;quot;ddlCountryID_edt&amp;quot; runat=&amp;quot;server&amp;quot; EnableViewState=&amp;quot;true&amp;quot;  Width=&amp;quot;240px&amp;quot;/&amp;gt;
  
                         &amp;lt;/td&amp;gt;
                        &amp;lt;/tr&amp;gt;
                     &amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;&amp;lt;asp:Label ID =&amp;quot;lblProvinceID_edt&amp;quot; runat=&amp;quot;server&amp;quot; Text =&amp;quot;Province:&amp;quot; /&amp;gt;&amp;lt;/td&amp;gt;
                        &amp;lt;td&amp;gt;
                        &amp;lt;asp:DropDownList ID=&amp;quot;ddlProvinceID_edt&amp;quot; runat=&amp;quot;server&amp;quot; Width=&amp;quot;240px&amp;quot; EnableViewState=&amp;quot;true&amp;quot;/&amp;gt;
                            &amp;lt;/td&amp;gt;                    
                    &amp;lt;/tr&amp;gt;
                     &amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;&amp;lt;asp:Label ID=&amp;quot;lblCityID_edt&amp;quot; runat =&amp;quot;server&amp;quot; Text = &amp;quot;City:&amp;quot;/&amp;gt; &amp;lt;/td&amp;gt;
                        &amp;lt;td&amp;gt;
                        &amp;lt;asp:DropDownList ID=&amp;quot;ddlCityID_edt&amp;quot; runat=&amp;quot;server&amp;quot; Width=&amp;quot;240px&amp;quot;  EnableViewState=&amp;quot;true&amp;quot;/&amp;gt;
    
                        &amp;lt;/td&amp;gt;
                        &amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;
                        &amp;lt;td&amp;gt;&amp;lt;asp:Label ID =&amp;quot;lblSuburbID_edt&amp;quot; runat=&amp;quot;server&amp;quot; Text =&amp;quot;Suburb:&amp;quot; /&amp;gt;&amp;lt;/td&amp;gt;
                        &amp;lt;td&amp;gt;
                        &amp;lt;asp:DropDownList ID=&amp;quot;ddlSuburbID_edt&amp;quot; runat=&amp;quot;server&amp;quot; Width=&amp;quot;240px&amp;quot; 
                                EnableViewState=&amp;quot;true&amp;quot; AutoPostBack=&amp;quot;True&amp;quot; 
                                onselectedindexchanged=&amp;quot;ddlSuburbID_edt_SelectedIndexChanged&amp;quot;/&amp;gt;
    
                        &amp;lt;/td&amp;gt;
                    &amp;lt;/tr&amp;gt;
 
                    &amp;lt;tr&amp;gt;        
                        &amp;lt;td valign=&amp;quot;top&amp;quot;  colspan=&amp;quot;2&amp;quot; align=&amp;quot;center&amp;quot;&amp;gt;
                            &amp;lt;asp:ImageButton ID=&amp;quot;btnUpdate&amp;quot; runat=&amp;quot;server&amp;quot; CommandName=&amp;quot;Update&amp;quot; ToolTip=&amp;quot;Save Changes&amp;quot;
                            ImageUrl=&amp;quot;~/images/buttons/1button-save.gif&amp;quot; ValidationGroup=&amp;quot;editvalidator&amp;quot; /&amp;gt;&amp;nbsp;
                            &amp;lt;asp:ImageButton ID=&amp;quot;btnCancel&amp;quot; runat=&amp;quot;server&amp;quot; CausesValidation=&amp;quot;False&amp;quot; CommandName=&amp;quot;Cancel&amp;quot; ToolTip=&amp;quot;Cancel&amp;quot;
                            ImageUrl=&amp;quot;~/images/buttons/1button-cancel.gif&amp;quot; /&amp;gt;
                        &amp;lt;/td&amp;gt;
                    &amp;lt;/tr&amp;gt;                    
                &amp;lt;/table&amp;gt;
            
                &amp;lt;cc1:CascadingDropDown ID=&amp;quot;ccdCountries_edt&amp;quot; 
                                       runat=&amp;quot;server&amp;quot; 
                                       TargetControlID=&amp;quot;ddlCountryID_edt&amp;quot; 
                                       Category=&amp;quot;Country&amp;quot; 
                                       PromptText=&amp;quot;Choose a Country....&amp;quot; 
                                       LoadingText=&amp;quot;Please wait ...&amp;quot; 
                                       ServicePath=&amp;quot;~/webservices/CountriesService.asmx&amp;quot; 
                                       ServiceMethod=&amp;quot;GetCountries&amp;quot;
                                       EmptyValue = &amp;quot;-1&amp;quot; 
                                       SelectedValue=&amp;#39;&amp;lt;%# Eval(&amp;quot;intCountryID&amp;quot;) %&amp;gt;&amp;#39; 
                                       EnableViewState=&amp;quot;true&amp;quot;
                                       &amp;gt;
                &amp;lt;/cc1:CascadingDropDown&amp;gt;
                &amp;lt;cc1:CascadingDropDown ID=&amp;quot;cddProvinces_edt&amp;quot; 
                                       runat=&amp;quot;server&amp;quot; 
                                       TargetControlID=&amp;quot;ddlProvinceID_edt&amp;quot; 
                                       ParentControlID=&amp;quot;ddlCountryID_edt&amp;quot; 
                                       Category=&amp;quot;Province&amp;quot; 
                                       PromptText=&amp;quot;Choose a Province....&amp;quot; 
                                       LoadingText=&amp;quot;Please wait ...&amp;quot; 
                                       ServicePath=&amp;quot;~/webservices/CountriesService.asmx&amp;quot; 
                                       ServiceMethod=&amp;quot;GetProvinces&amp;quot; 
                                       EmptyValue = &amp;quot;-1&amp;quot; 
                                       SelectedValue=&amp;#39;&amp;lt;%# Eval(&amp;quot;intProvinceID&amp;quot;) %&amp;gt;&amp;#39; 
                                       EnableViewState=&amp;quot;true&amp;quot;
                                       &amp;gt;
                &amp;lt;/cc1:CascadingDropDown&amp;gt;
                &amp;lt;cc1:CascadingDropDown ID=&amp;quot;cddCities_edt&amp;quot; 
                                       runat=&amp;quot;server&amp;quot; 
                                       TargetControlID=&amp;quot;ddlCityID_edt&amp;quot; 
                                       ParentControlID=&amp;quot;ddlProvinceID_edt&amp;quot; 
                                       Category=&amp;quot;City&amp;quot; 
                                       PromptText=&amp;quot;Choose a City....&amp;quot; 
                                       LoadingText=&amp;quot;Please wait ...&amp;quot; 
                                       ServicePath=&amp;quot;~/webservices/CountriesService.asmx&amp;quot; 
                                       ServiceMethod=&amp;quot;GetCities&amp;quot;
                                       EmptyValue = &amp;quot;-1&amp;quot; 
                                       SelectedValue=&amp;#39;&amp;lt;%# Eval(&amp;quot;intCityID&amp;quot;) %&amp;gt;&amp;#39; 
                                       EnableViewState=&amp;quot;true&amp;quot;
                                       &amp;gt;
                &amp;lt;/cc1:CascadingDropDown&amp;gt;
                
                &amp;lt;cc1:CascadingDropDown ID=&amp;quot;cddSuburbs_edt&amp;quot; 
                                       runat=&amp;quot;server&amp;quot; 
                                       TargetControlID=&amp;quot;ddlSuburbID_edt&amp;quot; 
                                       ParentControlID=&amp;quot;ddlCityID_edt&amp;quot; 
                                       Category=&amp;quot;Suburb&amp;quot; 
                                       PromptText=&amp;quot;Choose a Suburb....&amp;quot; 
                                       LoadingText=&amp;quot;Please wait ...&amp;quot; 
                                       ServicePath=&amp;quot;~/webservices/CountriesService.asmx&amp;quot; 
                                       ServiceMethod=&amp;quot;GetSuburbs&amp;quot; 
                                       EmptyValue = &amp;quot;-1&amp;quot; 
                                       SelectedValue=&amp;#39;&amp;lt;%# Eval(&amp;quot;intSuburbID&amp;quot;) %&amp;gt;&amp;#39; 
                                       EnableViewState=&amp;quot;true&amp;quot;
                                       &amp;gt;
                &amp;lt;/cc1:CascadingDropDown&amp;gt;               
   
          &amp;lt;/EditItemTemplate&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and here is a selection of the handler in the codebehind------- by the way i have a GoogleMapforASP User control on the page that i reference. Its not an issue here. Just the SelectedIndexChanged hander that executes when not expected.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;   protected void ddlSuburbID_edt_SelectedIndexChanged(object sender, EventArgs e)
    {
            
            DropDownList ddlCountryID = (DropDownList)fmvEnterpriseDetails.FindControl(&amp;quot;ddlCountryID_edt&amp;quot;);
            DropDownList ddlProvinceID = (DropDownList)fmvEnterpriseDetails.FindControl(&amp;quot;ddlProvinceID_edt&amp;quot;);
            DropDownList ddlCityID = (DropDownList)fmvEnterpriseDetails.FindControl(&amp;quot;ddlCityID_edt&amp;quot;);
            DropDownList ddlSuburbID = (DropDownList)fmvEnterpriseDetails.FindControl(&amp;quot;ddlSuburbID_edt&amp;quot;);

            int intCountryID = Convert.ToInt32(ddlCountryID.SelectedValue.ToString());
            int intProvinceID = Convert.ToInt32(ddlProvinceID.SelectedValue.ToString());
            int intCityID = Convert.ToInt32(ddlCityID.SelectedValue.ToString());
            int intSuburbID = Convert.ToInt32(ddlSuburbID.SelectedValue.ToString());

            string strBoundsX1 = &amp;quot;0.00000&amp;quot;;
            string strBoundsY1 = &amp;quot;0.00000&amp;quot;;
            string strBoundsX2 = &amp;quot;0.00000&amp;quot;;
            string strBoundsY2 = &amp;quot;0.00000&amp;quot;;
            string strSuburbLatitude = &amp;quot;0.00000&amp;quot;;
            string strSuburbLongitude = &amp;quot;0.00000&amp;quot;;
            if (intCountryID &amp;gt; 0 &amp;amp;&amp;amp; intProvinceID &amp;gt; 0 &amp;amp;&amp;amp; intCityID &amp;gt; 0 &amp;amp;&amp;amp; intSuburbID &amp;gt; 0)
            {
                // Grab the Suburb limits
                Suburb mySuburb = new Suburb();
                SqlDataReader reader = mySuburb.Get_tblSuburb_byCPCS(intCityID, intProvinceID, intCountryID, intSuburbID);
                while (reader.Read())
                {
                    strBoundsX1 = reader[&amp;quot;strBoundsX1&amp;quot;].ToString();
                    strBoundsY1 = reader[&amp;quot;strBoundsY1&amp;quot;].ToString();
                    strBoundsX2 = reader[&amp;quot;strBoundsX2&amp;quot;].ToString();
                    strBoundsY2 = reader[&amp;quot;strBoundsY2&amp;quot;].ToString();
                    strSuburbLatitude = reader[&amp;quot;strGPSLatitude&amp;quot;].ToString();
                    strSuburbLongitude = reader[&amp;quot;strGPSLongitude&amp;quot;].ToString();
                }

            }
            TextBox strBoundsX1_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strBoundsX1_edt&amp;quot;);
            TextBox strBoundsY1_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strBoundsY1_edt&amp;quot;);
            TextBox strBoundsX2_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strBoundsX2_edt&amp;quot;);
            TextBox strBoundsY2_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strBoundsY2_edt&amp;quot;);

            TextBox strGPSLatitude_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strGPSLatitude_edt&amp;quot;);
            TextBox strGPSLongitude_edt = (TextBox)fmvEnterpriseDetails.FindControl(&amp;quot;strGPSLongitude_edt&amp;quot;);

            strBoundsX1_edt.Text = strBoundsX1;
            strBoundsY1_edt.Text = strBoundsY1;
            strBoundsX2_edt.Text = strBoundsX2;
            strBoundsY2_edt.Text = strBoundsY2;

            strGPSLatitude_edt.Text = strSuburbLatitude;
            strGPSLongitude_edt.Text = strSuburbLongitude;

            gmap.GoogleMapObject.Points[&amp;quot;enterprise&amp;quot;].Latitude = Convert.ToDouble(strSuburbLatitude);
            gmap.GoogleMapObject.Points[&amp;quot;enterprise&amp;quot;].Longitude = Convert.ToDouble(strSuburbLongitude);

            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;TopLeft&amp;quot;].Latitude = Convert.ToDouble(strBoundsY1);
            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;TopLeft&amp;quot;].Longitude = Convert.ToDouble(strBoundsX1);

            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;BottomRight&amp;quot;].Latitude = Convert.ToDouble(strBoundsY2);
            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;BottomRight&amp;quot;].Longitude = Convert.ToDouble(strBoundsX2);

            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;TopRight&amp;quot;].Latitude = Convert.ToDouble(strBoundsY1);
            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;TopRight&amp;quot;].Longitude = Convert.ToDouble(strBoundsX2);

            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;BottomLeft&amp;quot;].Latitude = Convert.ToDouble(strBoundsY2);
            gmap.GoogleMapObject.Polygons[&amp;quot;SuburbBounds&amp;quot;].Points[&amp;quot;BottomLeft&amp;quot;].Longitude = Convert.ToDouble(strBoundsX1);
        
    }&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>DropDownList and AppendDataBoundItems in GridView EditItemTemplate</title><link>http://forums.asp.net/thread/3544534.aspx</link><pubDate>Wed, 02 Dec 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3544534</guid><dc:creator>SparTodd</dc:creator><description>&lt;p&gt;I have a GridView, which in the EditItemTemplate contains a DropDownList.&amp;nbsp; In the ItemTemplate itself the value displayed in the label is databound.&amp;nbsp; In the EditItemTemplate, though, I&amp;#39;m not only trying to bind the data from the database, but also offer additional values.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;My problem is that when I click an Edit button for the row and the mode changes, the DropDownList is defaulting to the first value in the ListItems.&amp;nbsp;&amp;nbsp; For example, if a row contains a value of &amp;quot;8:15 AM&amp;quot;, how can I set this up so that in Edit mode the DropDownList defaults to &amp;quot;8:15 AM&amp;quot; but also displays the other values available to make a selection from?&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre name="code" class="xhtml"&gt;&amp;lt;asp:GridView runat=&amp;quot;server&amp;quot; id=&amp;quot;exceptionsGridView&amp;quot; AutoGenerateColumns=&amp;quot;false&amp;quot; /&amp;gt;
	&amp;lt;columns&amp;gt;
		&amp;lt;asp:TemplateField&amp;gt;
			&amp;lt;ItemTemplate&amp;gt;
				&amp;lt;asp:Label runat=&amp;quot;server&amp;quot; Visible=&amp;quot;true&amp;quot; id=&amp;quot;lblBeginHM1&amp;quot;  
					Text=&amp;#39;&amp;lt;%# String.Format(&amp;quot;{0:h:mm tt}&amp;quot;, Convert.ToDateTime(Eval(&amp;quot;P1STARTHR&amp;quot;))) %&amp;gt;&amp;#39;&amp;gt;
				&amp;lt;/asp:Label&amp;gt;
			&amp;lt;/ItemTemplate&amp;gt;
			&amp;lt;EditItemTemplate&amp;gt;
				 &amp;lt;asp:DropDownList runat=&amp;quot;server&amp;quot; ID=&amp;quot;editP1BeginTimeDDL&amp;quot;  AutoPostBack=&amp;quot;False&amp;quot; 
					DataTextFormatString=&amp;#39;&amp;lt;%# String.Format(&amp;quot;{0:h:mm tt}&amp;quot;, Convert.ToDateTime(Eval(&amp;quot;P1STARTHR&amp;quot;))) %&amp;gt;&amp;#39; 
					AppendDataBoundItems=&amp;quot;true&amp;quot;  DataValueField=&amp;quot;STRHR1&amp;quot;  &amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:00 AM&amp;quot; Value=&amp;quot;0700&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:15 AM&amp;quot; Value=&amp;quot;0715&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:30 AM&amp;quot; Value=&amp;quot;0730&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:45 AM&amp;quot; Value=&amp;quot;0745&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;8:00 AM&amp;quot; Value=&amp;quot;0800&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;8:15 AM&amp;quot; Value=&amp;quot;0815&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;6:30PM&amp;quot; Value=&amp;quot;1830&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;6:45PM&amp;quot; Value=&amp;quot;1845&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:00PM&amp;quot; Value=&amp;quot;1900&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:15PM&amp;quot; Value=&amp;quot;1915&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:30PM&amp;quot; Value=&amp;quot;1930&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
						&amp;lt;asp:ListItem Text=&amp;quot;7:45PM&amp;quot; Value=&amp;quot;1945&amp;quot;&amp;gt;&amp;lt;/asp:ListItem&amp;gt;
				&amp;lt;/asp:DropDownList&amp;gt;
			&amp;lt;/EditItemTemplate&amp;gt;
		&amp;lt;/asp:TemplateField&amp;gt;
	&amp;lt;/columns&amp;gt;
&amp;lt;/asp:GridView&amp;gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; I appreciate any help and advice.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Dynamically creating Template Field in GridView</title><link>http://forums.asp.net/thread/3524462.aspx</link><pubDate>Fri, 20 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3524462</guid><dc:creator>pjlyons</dc:creator><description>&lt;p&gt;I&amp;#39;m&amp;nbsp;looking to create a template field and add it to my GridView control.&lt;/p&gt;
&lt;p&gt;I need this template field to contain a drop down list.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s what I have so far...&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;
&lt;p&gt;TemplateField &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;TestLab = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;TemplateField&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;TestLab.ItemTemplate = &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;
&lt;p&gt;&lt;font size="2"&gt;I&amp;#39;m not sure then how to define the ItemTemplate field, since I can&amp;#39;t create an instance of an ItemTemplate.&amp;nbsp;&amp;nbsp;How would&amp;nbsp;I define a new ItemTemplate? &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I know how to do the above in the code (see below), but not in code-behind.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;TemplateField&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;HeaderText&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;Assigned Bench&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;ItemStyle-Width&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;15%&amp;quot;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ItemTemplate&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;DropDownList&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;ID&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;AssignedTestBenchList&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;runat&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;server&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;AutoPostBack&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;True&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;OnSelectedIndexChanged&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;TestBenchChanged&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;Visible&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;false&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;Width&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;100px&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;/&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ItemTemplate&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;lt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;asp&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;:&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;TemplateField&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Paul&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;</description></item><item><title>Re: Setting the default value in dropdownlist</title><link>http://forums.asp.net/thread/3517862.aspx</link><pubDate>Tue, 17 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3517862</guid><dc:creator>smcirish</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After your databind to the dropdown list,&amp;nbsp; you can also add another additional value to the dropdown list&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.Items.Add(&amp;quot;none&amp;quot;);&lt;/p&gt;
&lt;p&gt;Then you can make whatever value you add above, the default value:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddl.SelectedValue = &amp;quot;none&amp;quot;;&lt;/p&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;</description></item></channel></rss>