Path for Missing Class in VWD2010 Express

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yiyi
    New Member
    • Oct 2012
    • 2

    Path for Missing Class in VWD2010 Express

    Hi all.

    I have an issue using Ajax Control Toolkit ComboBox.
    Here is my test markup page:

    Code:
    <%@ Page Language="C#" 
        AutoEventWireup="true" 
        CodeFile="Default2.aspx.cs" 
        Inherits="Default2" %> 
    <%@ Register Assembly="AjaxControlToolkit"
        Namespace="AjaxControlToolkit"
        TagPrefix="asp" %> 
    
    <!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> 
    </head> 
    <body> 
    <form id="form1" runat="server"> 
      <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager> 
      <div> 
        <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" /> 
        <% if (CheckBox1.Checked)
    { %>
        <asp:ComboBox ID="ComboBox1" runat="server">
        </asp:ComboBox> 
    <% } %> 
      </div> 
    </form> 
    </body> 
    </html>
    After CheckBox1 rises PostBack I get a NullReferenceEx ception in the method AjaxControlTool Kit.ComboBox.Sy stem.Web.UI.IPo stBackDataHandl er.LoadPostData (stringpostData Key, System.Collecti ons.Specialized .Name.ValueColl ection postCollection) and Visual Web Developer 2010 Express asks me the path of the Class ComboBox.cs that I don't have.

    Without <% if { } %> the ComboBox works fine.

    Can anyone help me?

    Thank you.
    Last edited by Frinavale; Oct 25 '12, 01:30 PM. Reason: Formatted code so that it is easier to read.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Instead of using the <%if{}%>, consider setting the ComboBox'sVisible property to the Checked property of the CheckBox in the method that handles the CheckBox1's CheckedChanged event.


    -Frinny

    Comment

    Working...