问题描述
嗨.....
我有一个日历控件,并且我想自定义这种方式以在该单元格中显示保存的事件...并带有事件标题和适当的工具提示..
我正在使用此代码..
Hi.....
i have a Calendar Control and i want to customize such a way to show the saved event in there cell...with event title and appropriate tooltip ..
i am using this code..
CalendarMonth_DayRender(object sender, DayRenderEventArgs e)
{
ds = objplanner.getEvent(pid, e.Day.Date);
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i]["Category"].ToString() == "Personal")
{
Label newLine = new Label();
newLine.Text = "<br/>";
e.Cell.Controls.Add(newLine);
LinkButton hlink = new LinkButton();
hlink.Text = "Personal";
hlink.ToolTip = ds.Tables[0].Rows[i]["Title"].ToString();
hlink.Attributes.Add("Align", "Center");
hlink.Style.Add("Font-Size", "8px");
hlink.Style.Add("padding-left", "30px");
hlink.Style.Add("padding-top", "50px");
hlink.ForeColor = System.Drawing.ColorTranslator.FromHtml("#B39BE4");
hlink.Attributes.Add("onClick", "hlink_onClick");
e.Cell.Controls.Add(hlink);
}
if (ds.Tables[0].Rows[i]["Category"].ToString() == "Reminder")
{
//same as above
}
}
//this event is not working ???
void hlink_onClick(object sender, EventArgs e)
{
Response.Redirect("~/WebForm1.aspx");
}
问题1 ...
虽然hlink是LinkButton,但我无法单击它... ??
我也添加了onClick事件,但从未执行..我不知道为什么??
问题2 ..
包含任何事件个人/提醒"或同时包含两者的日历单元格
在该单元格上,我无法单击单元格中显示的日期?????
问题3 ..
我还在我的calendarcontrol单元格中添加了一个图像按钮...
使用e.Cell.Controls.Add(imgbtn)....在所有单元格中都可以正常工作,但是哪个单元格包含任何事件..i无法单击此按钮...
(问题和2一样,但是)
问题4 ..
特定日期和示例的同一类别中可能有多个事件
个人...个人事件1 8:00 am-12:00am
PersonalEvent2 2:00 pm-5:00pm ... etc
在这种情况下,我只想显示一个事件..但我只想在每个单元格中显示一个指标..在这种情况下,个人两次将添加到我日历的单元格中..... .
请给我一些解决这些问题的方法...
如果尚未清除任何问题,请..ask
Problem 1...
although hlink is a LinkButton but i am not able to Click on it...??
i have also add onClick event but never execute..i dont know why ??
Problem 2..
the Calendar Cell Which contains any event Personal/Reminder or both
on that cell i am unable to click on date showed in cell ?????
Problem 3..
i have also add a image button in my calendarcontrol cell...
using e.Cell.Controls.Add(imgbtn)....in all cells it works fine but which cell contains any event ..i can not click on this button...
(problem same like 2 but)
Problem 4..
there can be more than one event for ant particular date falling in same category of Example
Personal...PersonalEvent1 8:00am-12:00am
PersonalEvent2 2:00pm-5:00pm...etc
in this condition i want to show only one event..but i want to show only one indicator in each cell..in this case two times personal will add in my calendar''s cell...........
Pls suggest me something to solve these problems...
if any point hasn''t cleared then please ..ask
推荐答案
这篇关于自定义日历控制单元...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!