Error using Calendar control in a Modal Dialog

Discussion in 'ASP .Net Web Controls' started by Cathie, Jul 9, 2003.

  1. Cathie

    Cathie Guest

    I am trying to use a calendar control in a modal dialog box but when I set
    SmartNavigation to true (necessary for the modal dialog to referesh itself
    when a button is fired) I get the following error:

    javascript__doPostBack('Calendar1','1287')
    Object Expected

    Is there any way to get this to work?
    Note: I am currently using Framework 1.0

    aspx code:
    <asp:Calendar id="Calendar1" runat="server"
    Visible="False"></asp:Calendar>
    (obviously &lt; = < and &gt; = >)

    aspx.cs code:
    protected System.Web.UI.WebControls.Calendar Calendar1;
    protected System.Web.UI.WebControls.TextBox TextBox1;
    protected System.Web.UI.WebControls.Button Button1;

    private void Page_Load(object sender, System.EventArgs e)
    {
    if (!IsPostBack)
    {
    Calendar1.SelectedDate = Calendar1.TodaysDate;
    }
    }

    private void InitializeComponent()
    {
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Calendar1.SelectionChanged += new
    System.EventHandler(this.Calendar1_SelectionChanged);
    this.Load += new System.EventHandler(this.Page_Load);
    }


    private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
    {
    TextBox1.Text = Calendar1.SelectedDate.ToString("dd/mm/yyyy");
    Calendar1.Visible = false;
    }

    private void Button1_Click(object sender, System.EventArgs e)
    {
    Calendar1.Visible = true;
    }


    Cathie
     
    Cathie, Jul 9, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.