I am getting this error “The control with ID 'PopupControlExtender111' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.” Please help.
Default.aspx
--------------------------------<%@ Register Src="MultiCheckCombo.ascx" TagName="MultiCheckCombo" TagPrefix="uc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><style type="text/css">
.scroll_checkboxes
{
height: 120px;
width: 200px;
padding: 5px;
overflow: auto;
border: 1px solid #ccc;
}
.FormText
{
font-size: 11px;
font-family: tahoma,sans-serif;
}</style><script language="javascript">
var color = 'White';
function changeColor(obj) {
var rowObject = getParentRow(obj);
var parentTable = document.getElementById("<%=chkList.ClientID%>");
if (color == '') {
color = getRowColor();
}
if (obj.checked) {
rowObject.style.backgroundColor = '#A3B1D8';
}
else {
rowObject.style.backgroundColor = color;
color = 'White';
}
// private method
function getRowColor() {
if (rowObject.style.backgroundColor == 'White') return parentTable.style.backgroundColor;
else return rowObject.style.backgroundColor;
}
}
// This method returns the parent row of the object
function getParentRow(obj) {
do {
obj = obj.parentElement;
}
while (obj.tagName != "TR")
return obj;
}
function TurnCheckBoixGridView(id) {
var frm = document.forms[0];
for (i = 0; i < frm.elements.length; i++) {
if (frm.elements[i].type == "checkbox" && frm.elements[i].id.indexOf("<%= chkList.ClientID %>") == 0) {
frm.elements[i].checked = document.getElementById(id).checked;
}
}
}
function SelectAll(id) {
var parentTable = document.getElementById("<%=chkList.ClientID%>");
var color
if (document.getElementById(id).checked) {
color = '#A3B1D8'
}
else {
color = 'White'
}
for (i = 0; i < parentTable.rows.length; i++) {
parentTable.rows[i].style.backgroundColor = color;
}
TurnCheckBoixGridView(id);
}
</script></head><body><form id="form1" runat="server"><div><!-- CHECKBOX LIST !--><div class="scroll_checkboxes"><asp:CheckBoxList Width="180px" ID="chkList" runat="server" CssClass="FormText" RepeatDirection="Vertical"
RepeatColumns="1" BorderWidth="0" Datafield="description" DataValueField="value"><asp:ListItem id="text1" Value="Select me 1" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text2" Value="Select me 2" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text3" Value="Select me 3" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text4" Value="Select me 4" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text5" Value="Select me 5" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text6" Value="Select me 6" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text7" Value="Select me 7" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text8" Value="Select me 8" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text9" Value="Select me 9" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text10" Value="Select me 10" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text11" Value="Select me 11" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text12" Value="Select me 12" onclick="changeColor(this);"></asp:ListItem><asp:ListItem id="text13" Value="Select me 13" onclick="changeColor(this);"></asp:ListItem></asp:CheckBoxList></div><!-- CHECKBOX LIST !--><br /><br /><uc1:MultiCheckCombo ID="MultiCheckCombo1" runat="server" /></div></form></body></html>
MultiCheckCombo.ascx
----------------------------------
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><script type = "text/javascript">
//Script para incluir en el ComboBox1 cada item chekeado del chkListMateriales
function CheckItem(checkBoxList) {
var options = checkBoxList.getElementsByTagName('input');
var arrayOfCheckBoxLabels = checkBoxList.getElementsByTagName("label");
var s = "";
for (i = 0; i < options.length; i++) {
var opt = options[i];
if (opt.checked) {
s = s + ", " + arrayOfCheckBoxLabels[i].innerText;
}
}
if (s.length > 0) {
s = s.substring(2, s.length); //sacar la primer 'coma'
}
var TxtBox = document.getElementById("<%=txtCombo.ClientID%>");
TxtBox.value = s;
document.getElementById('<%=hidVal.ClientID %>').value = s;
}</script><asp:TextBox ID="txtCombo" runat="server" ReadOnly="true" Width="200" Font-Size="X-Small"></asp:TextBox><cc1:PopupControlExtender ID="PopupControlExtender111" runat="server"
TargetControlID="txtCombo" PopupControlID="Panel111" Position="Bottom" ></cc1:PopupControlExtender><input type="hidden" name="hidVal" id="hidVal" runat="server" /><asp:Panel ID="Panel111" runat="server" ScrollBars="Vertical" Width="250" Height="150" BackColor="AliceBlue" BorderColor="Gray" BorderWidth="1"><asp:CheckBoxList ID="chkList"
runat="server"
Height="150" onclick="CheckItem(this)"></asp:CheckBoxList></asp:Panel>
MultiCheckCombo.ascx.cs
-----------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Odbc;
public partial class MultiCheckCombo : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Set the Width of the CheckBoxList
/// </summary>
public int WidthCheckListBox
{
set
{
chkList.Width = value;
Panel111.Width = value + 20;
}
}
/// <summary>
/// Set the Width of the Combo
/// </summary>
public int Width
{
set { txtCombo.Width = value; }
get { return (Int32)txtCombo.Width.Value; }
}
public bool Enabled
{
set { txtCombo.Enabled = value; }
}
/// <summary>
/// Set the CheckBoxList font Size
/// </summary>
public FontUnit fontSizeCheckBoxList
{
set { chkList.Font.Size = value; }
get { return chkList.Font.Size; }
}
/// <summary>
/// Set the ComboBox font Size
/// </summary>
public FontUnit fontSizeTextBox
{
set { txtCombo.Font.Size = value; }
}
/// <summary>
/// Add Items to the CheckBoxList.
/// </summary>
/// <param name="array">ArrayList to be added to the CheckBoxList</param>
public void AddItems(ArrayList array)
{
for (int i = 0; i < array.Count; i++)
{
chkList.Items.Add(array[i].ToString());
}
}
/// <summary>
/// Add Items to the CheckBoxList
/// </summary>
/// <param name="dr"></param>
/// <param name="nombreCampoTexto">Field Name of the OdbcDataReader to Show in the CheckBoxList</param>
/// <param name="nombreCampoValor">Value Field of the OdbcDataReader to be added to each Field Name (it can be the same string of the textField)</param>
public void AddItems(OdbcDataReader dr, string textField, string valueField)
{
ClearAll();
int i = 0;
while (dr.Read())
{
chkList.Items.Add(dr[textField].ToString());
chkList.Items[i].Value = i.ToString();
i++;
}
}
/// <summary>
/// Uncheck of the Items of the CheckBox
/// </summary>
public void unselectAllItems()
{
for (int i = 0; i < chkList.Items.Count; i++)
{
chkList.Items[i].Selected = false;
}
}
/// <summary>
/// Delete all the Items of the CheckBox;
/// </summary>
public void ClearAll()
{
txtCombo.Text = "";
chkList.Items.Clear();
}
/// <summary>
/// Get or Set the Text shown in the Combo
/// </summary>
public string Text
{
get { return hidVal.Value; }
set { txtCombo.Text = value; }
}
}