Trying to get my calendar to do some things datagrid can do?

g_r_a_robinson

Regular
Joined
Jan 13, 2004
Messages
71
I have datagrid that displays a list of events/occasions. Using the datagrids ItemCommand
I can select an item with the button column and move to another page with more info on that clicked item (see below)

C#:
private void C1WebGrid1_ItemCommand(object source, C1.Web.C1WebGrid.C1CommandEventArgs e)
	{
		if (e.CommandName == "GetNotes")
		{
			C1WebGrid1.SelectedIndex = e.Item.ItemIndex;
			jobID = (int) C1WebGrid1.DataKeys[e.Item.ItemIndex];
			Response.Redirect(PageBase.SecureUrlBase + @"/secure/NoteScreen.aspx", true);
			}

		}
I have a calendar control thats also populated with the exact same data, events/occasions etc. What I want to do is click on say the item and have it do exactly what the example above does for the datagrid, that is send me to another page with the retrieved data.

I am using the following to populate my calendar:

C#:
		public void eventscalendar_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
		{
			//use a StringBuilder object for optimized string concatenation
			StringBuilder strEvents = new StringBuilder();
			strEvents.Append("<span style=\"font-size:80%\">");
		
			foreach (DataRow row in jobData.Tables[JobData.JOBS_TABLE].Rows)
			{
				String test = row[JobData.CONTACTS_FIELD].ToString();
				if(row[JobData.CONTACTS_FIELD].ToString() == "null")
				{
					DateTime eventdate = Convert.ToDateTime(row[JobData.DUE_DATE_FIELD]);	
					DateTime Start_Time = Convert.ToDateTime(row[JobData.START_TIME_FOR_FREE_FIELD]);
					String due_Start_Time_String = Start_Time.ToShortTimeString();
					DateTime Finish_Time = Convert.ToDateTime(row[JobData.FINISH_TIME_FOR_FREE_FIELD]);
					String due_Finish_Time_String = Finish_Time.ToShortTimeString();
					String JobTitle = row[JobData.JOB_TITLE_FIELD].ToString();
					String JobNo = row[JobData.JOB_ID_FIELD].ToString();

					if (eventdate.Equals(e.Day.Date))
						strEvents.Append("<br>" + due_Start_Time_String +  "<br>" + due_Finish_Time_String + 
            "<a href= + JobTitle + >Here</a>" + JobNo + "<br><br>");
			
				}
			 
			//Close off the string in the strEvents StringBuilder
			strEvents.Append("</span>");
 
			//Add the string to the cell in a LiteralControl
			e.Cell.Controls.Add(new LiteralControl(strEvents.ToString()));

		}

This works fine and the link appears in the item. But I don't want this to be display a url in the browser. I really need it to do it how my datagrid does it, behind the scenes.

Any suggestions would be most appreciated. I've been on this for weeks.

[edit]Please use
C#:
 tags [/ cs][/edit][/COLOR]
 
Last edited by a moderator:
Back
Top