how to bring data's in calendar control in asp.net 2.0 .

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sureshl
    New Member
    • Jan 2009
    • 23

    #1

    how to bring data's in calendar control in asp.net 2.0 .

    Hi, i dunno how to use calendar control . i need to bring data to the calendar on the respective date , whether calendar control will work both server side and client side. coz if i disable the javascript in mozilla , i couldnt able to scroll through the month , why so . ?

    Want to display , data's from the table on the respective date in that control.. .

    Code:
    CREATE TABLE [dbo].[table1](
        [fid] [int] IDENTITY(1,1) NOT NULL,
        [Shows] [varchar](100) NULL,
        [frmdate] [datetime] NULL,
        }
    i need to display the shows on the calender , .
    Plz suggest...how to use the calender....?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    What kind of Calendar control are you using?
    Are you using the pure ASP.NET Calendar control or are you using an Ajax calendar control?

    Comment

    • sureshl
      New Member
      • Jan 2009
      • 23

      #3
      pure asp.net

      pure asp.net calendar tool ..
      my code behind is c#

      I am trying to build a calendar that loads the fields from a SQL database. I have a asp:calendar control on my web form.

      The database has one table :
      I need to know how to load the items from db to appear on a calendar . I'm using Visual Studio 2005, code behind is in C#.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Please check out the following articles for information on how to connect to and read information from a database:

        Once you've retrieved the data from the database, set the calendar's date.

        Comment

        • ANU ROSE GEORGE

          #5
          if you are having a table with the following fields
          LID varchar(50)
          date datetime

          write stored procedure as following

          Code:
          CREATE PROCEDURE DISPLAYSCHEDULE
          	@LID varchar(50)
          	
          AS
          	select date from PSSDocShed
          	where LID=@LID
          here PSSDocShed is the table name and DISPLAYSCHEDULE is the stored procedure name

          in Bussiness class you need to write the following

          Code:
          public static DataTable displayschedule(string id)
                  {
          
                      DbCommand cmd = GenericData.CreateCommand();
                      cmd.CommandText = "DISPLAYSCHEDULE";
                      cmd.Parameters.Add(new SqlParameter("@LID", id));
                      return GenericData.ExecuteReader(cmd);
          
                  }
          now come to our calender page click event DayRender
          and type the following

          Code:
          protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
              {
                  string id = Request.Cookies["PSSuid"].Value;
                  DataTable tb = businessclass.displayschedule(id);
                  for (int i = 0; i < tb.Rows.Count; i++)
                  {
                      
                      if (e.Day.Date == Convert.ToDateTime(tb.Rows[i][0]))
                      {
                          e.Cell.BackColor = System.Drawing.Color.Pink;
                         
                      }
                      
                  }
                  
          
          
          
              }
          this will result in
          change the background color of the selected dates from database
          and other dates remains as such


          Hope this will help you
          if you are using stored procedures and Three -tier architecture

          Comment

          Working...