Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Ajax Control Toolkit ComboBox NullReferenceException after CheckBox postback, PostBack error, missing ComboBox.cs

$
0
0

Hi all.

I'm trying to use ACT ComboBox. I made a Test page. Here the markup code:

<%@ Page Title="" Language="C#" MasterPageFile="~/Manuale.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<%	if (CheckBox2.Checked)
	{ %>
	<asp:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="SuggestAppend" 
		DataSourceID="SqlDataSource1" DataTextField="S_PRESTAZIONE" 
		DataValueField="ID_S_PRESTAZIONE" MaxLength="10"
		onselectedindexchanged="ComboBox1_SelectedIndexChanged"
		style="display: inline;" AutoPostBack="True" ClientIDMode="Static" 
		EnableTheming="True" RenderMode="Block" ViewStateMode="Enabled" >
	</asp:ComboBox>
	<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
	<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
		ConnectionString="<%$ ConnectionStrings:ManualiConnectionString %>" 
		
		SelectCommand="SELECT 0 AS ID_S_PRESTAZIONE, '------' AS S_PRESTAZIONE UNION ALL SELECT [ID_S_Prestazione], [S_Prestazione] FROM [S_Prestazioni] ORDER BY S_PRESTAZIONE"></asp:SqlDataSource>
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" />
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink>
<%	} %>
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" />
</asp:Content>

Where I click on CheckBox2 to view the controls inside the "if" I get the follow error:

AjaxControlToolKit.DDL!AjaxControlToolKit.ComboBox.System.Web.UI.IPostBackDataHandler.LoadPostData(stringpostDataKey, System.Collections.Specialized.Name.ValueCollection postCollection) Line 667 + 0x14 byte

The code works well without the if.

Can anyone help me?

Thank you.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>