0
我想在asp.net中將與服務器一起使用的事件日曆 我已經嘗試了一些沒有服務器在這裏的代碼;事件日曆Asp.Net與服務器
<asp:Calendar ID="Calendar1" runat="server" Font-Names="Verdana" OnDayRender="Calendar1_DayRender" BackColor="White" BorderColor="Black" BorderStyle="Solid" CellSpacing="1" Font-Size="9pt" ForeColor="Black" Height="250px" NextPrevFormat="ShortMonth">
<SelectedDayStyle BackColor="#333399" ForeColor="White" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" />
<DayStyle BackColor="#CCCCCC" Height="50px" Width="100px" />
<NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="White" />
<DayHeaderStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" Height="8pt" />
<TitleStyle BackColor="#333399" BorderStyle="Solid" Font-Bold="True" Font-Size="12pt" ForeColor="White" Height="12pt" />
</asp:Calendar>
這裏代碼後面的代碼;
public partial class Default : System.Web.UI.Page
{
string[,] etkinlik;
protected void Page_Load(object sender, EventArgs e)
{
etkinlik = new string[13, 32];
etkinlik[3, 22] = "2.Yazılı";
etkinlik[4, 23] = "23 nisan milli egemenlik bayramı";
etkinlik[4, 26] = "Asp.net Sınavı";
etkinlik[5, 1] = "İşçi Bayramı";
etkinlik[5, 19] = "Gençlik ve Spor Bayramı";
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsOtherMonth)
{
e.Cell.Controls.Clear();
}
else
{
Label lbl = new Label();
lbl.CssClass = "css_appointment";
string etkin = etkinlik[e.Day.Date.Month, e.Day.Date.Day];
if (etkin != "")
{
lbl.Text = "<br />";
lbl.Text += etkin;
e.Cell.Controls.Add(lbl);
}
}
}
}
Etkinlik意味着= event.So,你看,我可以把它曼努埃爾但我不知道我怎樣才能使與服務器這項工作。你能幫我讓這個工作與服務器。我需要選擇日期和名稱,然後添加到服務器並在日曆上顯示。我從未嘗試過日曆事物。我只是做了正規的asp .net實體框架的東西
更慣用的方法是'如果(!String.IsNullOrWhiteSpace(etkin))' –
是的,但是當u添加手動我想使用事件服務器創建新的工作原理。接近這個http://arshaw.com/fullcalendar/。所以它必須與服務器一起使用,而不是手動使用代碼。就像從管理面板添加新文章一樣。我想從管理面板添加事件 – user3717626
然後,您需要將您的信息從管理面板存儲到數據庫中,然後在加載頁面時將其綁定到日曆控件,與手動數組字符串相同。 –