i have a calender and i was able to add text-box inside the cell using the day-render event but what i am trying to do is allow the user to add data to the text-box and then press add and the content is added to a database and showed inside that same text-box:
here is what i did:
protected void Page_Load(object sender, EventArgs e)
{
Calendar1.SelectedDate = DateTime.Now;
}
protected void update(object sender, DayRenderEventArgs e)
{
TextBox tb = new TextBox();
Button1.click += new EventHandler(insert);
e.Cell.Controls.Add(Button1);
e.Cell.Controls.Add(textBox2);
}
protected void insert(object sender, EventArgs e)
{
}
and i know how to insert the data but i am lost on how to identify it and output it back to the same text box
thanks
Well I’m not sure exactly what part you are lost on based on your question, so short of providing a complete working example I’ll hit some of the main points:
1) To identify the data you are inserting, attach a date (and time if applicable) to the record. (Edit: are you looking for a mechanism to accomplish this? If so post your current
DayRenderhandler code andCalendarmarkup).2) To populate individual day data in a calendar, use
Calendar.VisibleDate(to filter DB results) in aPage.Loadhandler to load a data structure (such as aList<T>) with day data for the entire month. Then in aCalendar.DayRenderhandler, add appropriate records from the structure to thee.Cell.3) To cause the new results to show up on the first page refresh after insertion, you should be able to get away with using a
Response.Redirectto the current page after insertion. This will cause the page generation process to restart, but you will lose ViewState.Edit: Here is a basic prototype of what I tried to describe above. Note that you could pre-fetch into any enumerable data type, I use a
List<T>here.