troubleshooting Question

Unable to get ComboBox to display Dropdown List when master page does not exist

Avatar of pclarke7
pclarke7 asked on
ASPC#* combobox
2 Comments1 Solution58 ViewsLast Modified:
I am using an AjaxControlToolkit ComboBox in a C# web application. My Webform page will not display the contents of the dropdown list added in code behind. This works when I have a master page. However I need to remove the m,aster page from the project and this results is the dropdown list not displaying. Appreciate if someone can explain how I can get the dropdown list working without the master page.

regards
Pat

WebForm.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="TiosClient.WebForm3" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" />
        </div>
        <asp:Button ID="Button2" runat="server" Text="Button" />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        
        <ajaxToolkit:ComboBox ID="ComboBox1" runat="server">
        </ajaxToolkit:ComboBox>

         <div >
           <p><ajaxToolkit:ComboBox ID="ComboBox2" runat="server">
            </ajaxToolkit:ComboBox>
            </p>
    </div>


         <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
    </form>

</body>
</html> 

Open in new window


WebForm3.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TiosClient
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string test1 = "Testing WenForm3...";
            Button1.Text = test1;
            ComboBox1.ClearSelection();
            ComboBox1.Dispose(); // required to clear previous values
            ComboBox1.Items.Clear();
            ComboBox1.Text = "HelloThere ";
            ComboBox1.Items.Add("Option1");
            ComboBox1.Items.Add("Option2");
            ComboBox1.Items.Add("Option3");
            ComboBox1.Items.Add("Option4");
            ComboBox1.Visible = true;
            ComboBox1.MaxLength = 500;

            ComboBox2.ClearSelection();
            ComboBox2.Dispose(); // required to clear previous values
            ComboBox2.Items.Clear();
            ComboBox2.Text = "HelloThere ";
            ComboBox2.Items.Add("Option1");
            ComboBox2.Items.Add("Option2");
            ComboBox2.Items.Add("Option3");
            ComboBox2.Items.Add("Option4");
            ComboBox2.Visible = true;
            ComboBox2.MaxLength = 500;


        }
    }
}

Open in new window



When I display the content of ComboBox1.ListItem it contains
[0] {Option1}
[1] {Option2}
[2] {Option3}
[3] {Option4}

as expected but when I click on the dropdown arrow there is no content displayed
ASKER CERTIFIED SOLUTION
pclarke7

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 2 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 2 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004