TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
goksu kilic
NA
6
1.3k
calendar control
Sep 8 2018 5:15 AM
I use calendar control in my projec.But error getting "calendar1".Error description is "the name calendar1 does not exist in the current context."
Calendar1.
Attributes.Add("class", "labelLogin");
Calendar1
.Attributes.Add("title", "");
Source code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
Class1 classim = new Class1();
DateTime[] dates;
Class1.ClsData clsData;
DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
VerileriGetir();
}
private void VerileriGetir()
{
#region takvimload
if (!IsPostBack)
{
Calendar1.Attributes.Add("class", "labelLogin");
Calendar1.Attributes.Add("title", "");
clsData = new Class1.ClsData();
dt = clsData.NotesDate();
Session.Add("dtdata", dt);
}
dt = Session["dtdata"] as DataTable;
dates = new DateTime[dt.Rows.Count];
for (int i = 0; i < dt.Rows.Count; i++)
dates[i] = Convert.ToDateTime(dt.Rows[i][1].ToString());
#endregion
}
#region takvim ayar
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
for (int i = 0; i <= dates.GetUpperBound(0); i++)
{
if (e.Day.Date == dates[i])
{
e.Cell.Attributes.Add("class", "clndTopMenu");
e.Day.IsSelectable = true;
e.Cell.BackColor = System.Drawing.Color.FromName("#f79646");
e.Cell.ForeColor = System.Drawing.Color.Wheat;
string sorgu = "Select * from ETKINLIK Where Tarih like '%" + e.Day.Date.ToString().Substring(0, 10) + "%'";
//DataRow etkicek = kisayol.GetDataRow(sorgu);
SqlConnection baglan = new SqlConnection("Data Source=localhost;initial catalog=KodBank;User Id=sa;Password=123;");
baglan.Open();
SqlCommand komut = new SqlCommand(sorgu, baglan);
SqlDataReader oku;
oku = komut.ExecuteReader();
StringBuilder builde = new StringBuilder();
while (oku.Read())
{
string body = oku["Etkinlik"].ToString() + @"</br> <font color=""#5732c3""> </br> Düzenlenme Saati : " + oku["Tarih"].ToString().Substring(10, 6) + "</font><hr>";
builde.Append(body);
}
e.Cell.Attributes.Add("onMouseOver", "javascript:Goster('" + builde.ToString() + "');");
e.Cell.Attributes.Add("onMouseOut", "javascript:Gizle();");
}
}
}
#endregion
}
Reply
Answers (
3
)
Please solve this query
Last row doesnt been displayed