2
Answers

Selected date in a Calender equils the date in my database?

khalid Johnson

khalid Johnson

17y
3.1k
1

C# asp.NET

I have a formview and a calendar. In the formview I can add an appointment with 3 inputboxes. Description, person_id and the date. When I click in the calendar on a date I will check if there is an appointment. If there is an appointment I will see it in the textbox under the calendar.


I have now this code, but it wont work..I have make an datasource with only a SELECT query on atribute date. In an if I will check if there is an date in my database equal the selected date in the calendar! But the code that now have dousnt work. I hope you understand my problem and can help me..Thanks

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            TextBoxRoosterGegevens.Text = "Selected date is: " + Calendar1.SelectedDate.ToString();

            //just a test
            if (Calendar1.SelectedDate.ToString().Equals(SqlDataSourceDate.ToString()))
            {
                TextBox1.Text = "This date has an description: ";
            }
            else
                TextBox1.Text = "no description ";
            // SELECT bla bla WHERE Calendar1.SelectedDate = date
        }

 

This is SqlDataSourceDate:
Answers (2)