Calender in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ThsSchmoo
    New Member
    • Feb 2008
    • 3

    Calender in C#

    Hi,

    I am new to C#, and i need to have a calender on my web app (asp.net). which will allow the user to select the days that the are available to work. Then I need to record these dates in a database. Any Ideas?

    Regards,

    Schmoo
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    ASP.NET has a Calender control, you should be able to find it in the toolbox.

    Comment

    • ThsSchmoo
      New Member
      • Feb 2008
      • 3

      #3
      Yes I am aware of that, but can anybody help me with code

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        What code? You drop the Calender control on the form and use it's SelectedDate property?

        Comment

        • ThsSchmoo
          New Member
          • Feb 2008
          • 3

          #5
          Code:
          DateTime Date1;
          Date1 = cdr1.SelectedDate.ToString;
          txtDate.Text = Date1
          Any idea how to convert the date to a string?
          Last edited by Plater; Feb 20 '08, 01:47 PM. Reason: adding code tags

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by ThsSchmoo
            DateTime Date1;

            Date1 = cdr1.SelectedDa te.ToString;

            txtDate.Text = Date1

            Any idea how to convert the date to a string?
            You could (*)read about it.


            (*)read :- to obtain information by looking at words, symbols or other information that is written. (This is becoming an extinct art among students)

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              Originally posted by ThsSchmoo
              Code:
              DateTime Date1;
              
                      Date1 = cdr1.SelectedDate.ToString;
              
                      txtDate.Text = Date1
              Any idea how to convert the date to a string?
              You're converting the date to a string right there.
              Well you're doing it in the wrong order, but you're doing it.

              Code:
              DateTime Date1;
              Date1 = cdr1.SelectedDate;
              txtDate.Text = Date1.ToString();

              Comment

              • mohamedraja
                New Member
                • Jan 2008
                • 1

                #8
                how to assign the database date to the calender control in asp.net

                Dayrender Event




                string StrDate = "Select Dates From Tblallottimepat ient where DID=" + 1;
                cmd = new SqlCommand(StrD ate, con);
                openconnection( );
                sdr = cmd.ExecuteRead er();
                while (sdr.Read())
                {
                DateTime da=Convert.ToDa teTime(sdr[0].ToString());
                if (Convert.ToDate Time(e.Day.Date .Date.ToString( )) == da)//&& e.Day.Date.Mont h==7)
                {
                e.Cell.BackColo r = System.Drawing. Color.Beige;
                }
                }
                sdr.Close();
                Closedconnectio n();

                Comment

                Working...