Click here to Skip to main content
15,905,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
the user can insert events through my website into my database and the details they entered will appear on my asp calendar. how do i prevent them from selecting a date that have passed and only select a future date.

I also have problem trying to insert the values they entered into the textbox fields to be shown on the asp calender. can this be done? or is there any other ways i can solve this issue?

The details user has entered is already recorded in my database but cannot be shown on the asp calendar.

Any help will be greatly appreciated.
Posted

1 solution

 
Share this answer
 
Comments
Member 10106656 24-Jun-13 10:36am    
Hi, how do i customize my own database in , because i changed the details but still it cant work. could you help ? thank you.
Tiwari Avinash 25-Jun-13 7:30am    
Sorry for the late response!
I cant understand your point, it will be grate if you can provide some of code which you have tried.
Member 10106656 25-Jun-13 23:33pm    
Hi, these are the codes i inserted i changed the database path and what to display, but the outcome of it is still nothing. Hope you can help thank you.

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Planner : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|test.mdf;Integrated Security=True;User Instance=True");//for connection
SqlDataAdapter da;
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{

da = new SqlDataAdapter("select eventName from userPlanner", con);
da.Fill(ds);//we fill dataset ds from all the data of holidays table
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
if (ds.Tables[0].Rows[i].ItemArray.Contains(e.Day.Date))
{
if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
{
e.Cell.ToolTip = ds.Tables[0].Rows[i][1].ToString();
}
else
{
e.Cell.ForeColor = Color.White;
e.Cell.BackColor = Color.Red;
e.Cell.ToolTip = ds.Tables[0].Rows[i][1].ToString();//for tooltip
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{

}
}
Tiwari Avinash 26-Jun-13 1:50am    
I'm not able to find the root cause of your problem.

please check the following and let me know
1. DS contains table at 0th position
2. table[0] has valid data
3. the code under second if condition getting executed

if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
{ e.Cell.ToolTip = ds.Tables[0].Rows[i][1].ToString(); }

after day render event calender is not getting refreshed again or any other event


I have tried this code and its working fine for me.
Member 10106656 26-Jun-13 1:59am    
Sorry , but i realize that mine is visual studio 2010 . could it be the problem , if it is any solution for that ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900