DataBinding a Calendar's "TodaysDate" Property

Last post 11-12-2009 3:51 PM by sayyazahmad. 2 replies.

Sort Posts:

  • DataBinding a Calendar's "TodaysDate" Property

    11-12-2009, 10:17 AM
    • Member
      point Member
    • tlbaxter99
    • Member since 09-13-2007, 4:12 AM
    • New Haven, CT USA
    • Posts 12

    Hello everyone,


    I have a Calendar control that needs to display a date taken from a database. I would like to databind the 'TodaysDate' property but this property is not decorated with the 'BindableAttribute' for some reason. This means the 'TodaysDate' property is not available in the Visual Studio databindings window.


    My first question is, why does 'TodaysDate' not have BindableAttribute? It seems everyone will want to bind to this property.


    Second, how can I bind to 'TodaysDate' (I want two-way binding). Since Visual Studio does not allow me to specify this property I am guessing I have to edit the aspx file, somehow. Is that correct?


    Thanks very much.

    ===================

    I know what was wrong. I needed to one-way bind the 'TodaysDate' property and I need to two-way bind the 'SelectedDate' property:

    TodaysDate='' SelectedDate=''>


    Binding the 'TodaysDate' property tells the Calendar to display the date from the database while binding the SelectedDate property tells the Calendar to send the newly selected date back to the database during an update.


    It still seems weird that 'TodaysDate' is not decorated with the 'BindableAttribute'.


    Hello everyone,
    I have a Calendar control that needs to display a date taken from a database. I would like to databind the 'TodaysDate' property but this property is not decorated with the 'BindableAttribute' for some reason. This means the 'TodaysDate' property is not available in the Visual Studio databindings window.
    My first question is, why does 'TodaysDate' not have BindableAttribute? It seems everyone will want to bind to this property.
    Second, how can I bind to 'TodaysDate' (I want two-way binding). Since Visual Studio does not allow me to specify this property I am guessing I have to edit the aspx file, somehow. Is that correct?
    Thanks very much.
    ===================
    I know what was wrong. I needed to one-way bind the 'TodaysDate' property and I need to two-way bind the 'SelectedDate' property:
    TodaysDate='' SelectedDate=''>
    Binding the 'TodaysDate' property tells the Calendar to display the date from the database while binding the SelectedDate property tells the Calendar to send the newly selected date back to the database during an update.
    It still seems weird that 'TodaysDate' is not decorated with the 'BindableAttribute'.




  • Re: DataBinding a Calendar's "TodaysDate" Property

    11-12-2009, 1:52 PM
    Answer
    • Contributor
      5,014 point Contributor
    • deepthoughts
    • Member since 01-27-2009, 2:55 PM
    • Posts 739

    You can bind TodaysData property as well. Like this..

    <asp:Calendar ID="Calendar1" runat="server" TodaysDate='<%# Bind("DT") %>'></asp:Calendar>


     Thanks.

    MARK AS ANSWER if it helps
  • Re: DataBinding a Calendar's "TodaysDate" Property

    11-12-2009, 3:51 PM
    Answer
    • Member
      402 point Member
    • sayyazahmad
    • Member since 01-17-2008, 6:46 PM
    • US
    • Posts 83

    You can get the TodayDate from database, like GetDate(). Try this...

    Select IsNull(DateColumn, GetDate()) From Table

    Please Mark As Answer if it helps you!
Page 1 of 1 (3 items)