1
Reply

Select item on GridView

NETFAN

NETFAN

May 11 2005 4:27 AM
1.8k
Hi, I have the following problem. I have a Calendar on a page with a dateselect method and a Gridview with a Select item enabled, no datasource connected. The Grid is filled via a dataset .... On dateselect -> fills the GridView When I run it, it says it cant do a Databind. And its probably because I enabled AutoGenerateSelectButton. I need because I need to be able to select an item from the gridview. Anyone? protected void Calender_Schedule_SelectionChanged(object sender, EventArgs e) { int day, month, year; string sql; day = Calender_Schedule.SelectedDate.Day; month = Calender_Schedule.SelectedDate.Month; year = Calender_Schedule.SelectedDate.Year; sql = "select * from schedule where Scheduleday='" + day.ToString() + "' and Schedulemonth='" + month.ToString() + "' and Scheduleyear='" + year.ToString() + "'"; SqlDataAdapter Ad = new SqlDataAdapter(sql, Conn); DataSet ds = new DataSet(); Ad.Fill(ds, "Schedule"); GridView_Schedule.DataSource = ds; GridView_Schedule.DataBind(); } Hope this code helps you Thx Kind regards NETFAN

Answers (1)