I have got a problem in creating database event calendar asp sample

Asked By 0 points N/A Posted on -
qa-featured

Hi friends

I have some problem to share with you.

Recently I want to create a database event calendar but I am failed to create it please help me.

I want to make a HTML schedule type calendar.

Also send me database event calendar asp sample.

Thanks.

SHARE
Best Answer by Thomas C Saucedo
Answered By 55 points N/A #169414

I have got a problem in creating database event calendar asp sample

qa-featured

Hello Costaa Drianna,

I have some of the code that can help you in making a complete database and also can help you in learning how to make connections between web and database.

It can also help you in making PHP code for data accessing and data entering.

There is a zip file with this post you can download and can check that file after that i think that you can get what you want.

 
Best Answer
Best Answer
Answered By 30 points N/A #169415

I have got a problem in creating database event calendar asp sample

qa-featured

 

Hello,
 
These are  sample on how to create an events Calendar  using ASP.NET.  Database
 works on IE and Firefox.
 
1.On a Database Design,  there is a table and its called "Schedules", 
Figured table has following fields:
*a Schedule ID
*Title
*Schedule date 
 
Next is the DataSet. Learn it on the given sample below;  
 
private DataSet GetData()
    {
        string connectionString = "Server=localhost;Database=School;Trusted_Connection=true";
        SqlConnection myConnection = new SqlConnection(connectionString);
        SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Schedules", myConnection);
 
        DataSet ds = new DataSet();
        ad.Fill(ds);
 
        return ds;
    }
 
2. Fill the  Data from Database
Follow on this next sample 
 
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        DataSet ds = GetData();
 
        string link = "<a href='ScheduleDetails.aspx?scheduleID=";
 
        string s = e.Day.Date.ToShortDateString();
 
        e.Cell.Text = e.Day.Date.Day.ToString() + "<BR>";
 
        LiteralControl l = new LiteralControl();
        l.Text = e.Day.Date.Day.ToString() + "<BR>";
        e.Cell.Controls.Add(l);
 
        foreach (DataRow row in ds.Tables[0].Rows)
        {
            string scheduledDate = Convert.ToDateTime(row["ScheduleDate"]).ToShortDateString();
 
            if (scheduledDate.Equals(s))
            {
                LinkButton lb = new LinkButton();
                lb.Text = link + (int)row["ScheduleID"] + "'>" + row["Title"] as String + "</a>" + "<BR>";
                e.Cell.Controls.Add(lb);              
            }         
        }
 
        HtmlAnchor anchor = new HtmlAnchor();
        anchor.InnerHtml = "Add";
       
        string method = "ShowAddTaskPane(event,'" + e.Day.Date.ToShortDateString() + "')";
 
        anchor.href="#";
        anchor.Attributes.Add("onclick", method);
        e.Cell.Controls.Add(anchor);      
     
    }
 
 
The ADD button could also help you create quick adding events.
 
3. Now the Adding New Events;
It is not necessary to use another page to add new events, you can do it on the same page.
  *check this sample 1 task is to create "DIV" this contains TEXTBOX and CONTROL button to ADD Event.
 
  <div id="AddTaskPane" onblur="this.style.visibility='hidden'" style="position:absolute; visibility:hidden; width:200px; height:100px; background-color:#FFFF66">
      
       Enter Title: <asp:TextBox ID="txtTitle" runat="server" />
      
           <asp:Button ID="Btn_AddTask" runat="server" Text="Add Task" OnCommand="Btn_AddTask_Command" />     
      
      
       </div>
 
The <DIV> is made invisible and will only appear when the “Add” link is clicked. The code to create the “Add” link is inside the DayRender event but I am re-pasting it so that you will have a better idea.
 
HtmlAnchor anchor = new HtmlAnchor();
        anchor.InnerHtml = "Add";
       
        string method = "ShowAddTaskPane(event,'" + e.Day.Date.ToShortDateString() + "')";
 
        anchor.href="#";
        anchor.Attributes.Add("onclick", method);
        e.Cell.Controls.Add(anchor); 
 
 
The ShowAddTaskPane is fired when the user clicks on the “Add” link. Let’s take a look at the ShowAddTaskPane method.
 
function ShowAddTaskPane(e,selectedDate)
{
 
    var ev = e || window.event;  
   
     
    document.getElementById("AddTaskPane").style.visibility  = 'visible';
    document.getElementById("AddTaskPane").style.top = ev.clientY;
    document.getElementById("AddTaskPane").style.left = ev.clientX; 
   
    CallServer(selectedDate,''); 
    
}  
 it will show like this on the image:
 
 
hope this codes could help you in any ways.
 
Thomas
 

Related Questions