Hi
i would like to know why i cant make telerik items visiable once i have declared them visable = false in page load and i would also like to know why i cant rebind to a grid when i have told the grid server side to rebind
Many thanks in advance
i would like to know why i cant make telerik items visiable once i have declared them visable = false in page load and i would also like to know why i cant rebind to a grid when i have told the grid server side to rebind
Many thanks in advance
3 Answers, 1 is accepted
0
Hi Kevin,
We would need some more clarification on the approaches you have taken with RadControls. Could, you, please describe how do you define your grid structure, data source and how do you rebind your grid. You can also provide some sample code we can examine.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
We would need some more clarification on the approaches you have taken with RadControls. Could, you, please describe how do you define your grid structure, data source and how do you rebind your grid. You can also provide some sample code we can examine.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 02 Jul 2009, 12:40 PM
Hi Veli i can Provide the sample code and the approaches with the controls
The approaches that we are using on the controls are that when the page is loaded it is loaded into a rad window from there i want to have the one ComboBox RadCboOthers disabled and then be able to reenable it when RadCboAppliance has a selected value of "Not In List". The Rad Grids that we are using dont want to have data in them until certain Requirements are met such as the Priority has been selected and there is a day selected in the calendar. Also with the calendar i want to know how do i clear the Special days that are implemented and then reenable the new special days when the priority is changed.
this is the code that we are using on the page
At the moment none of the above is able to be done and it is holding us back on the project that we are using the toolkit for
The approaches that we are using on the controls are that when the page is loaded it is loaded into a rad window from there i want to have the one ComboBox RadCboOthers disabled and then be able to reenable it when RadCboAppliance has a selected value of "Not In List". The Rad Grids that we are using dont want to have data in them until certain Requirements are met such as the Priority has been selected and there is a day selected in the calendar. Also with the calendar i want to know how do i clear the Special days that are implemented and then reenable the new special days when the priority is changed.
this is the code that we are using on the page
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Configuration; | |
| using System.Data.Linq; | |
| using System.Data; | |
| using System.Data.SqlClient; | |
| using System.Linq; | |
| using System.Web; | |
| using System.Drawing; | |
| using System.Web.Security; | |
| using System.Web.UI; | |
| using System.Web.UI.HtmlControls; | |
| using System.Web.UI.WebControls; | |
| using System.Web.UI.WebControls.WebParts; | |
| using System.Windows.Forms; | |
| using System.Xml.Linq; | |
| using WebSchedule.DataLayer; | |
| using Subgurim.Controles; | |
| using Telerik.Web.UI; | |
| using Telerik.Web.UI.Calendar.View; | |
| namespace WebSchedule | |
| { | |
| public partial class Repair : System.Web.UI.Page | |
| { | |
| int weekNumber | |
| { | |
| get | |
| { | |
| if (Session["WeekNumber"] == null) | |
| { | |
| Session["WeekNumber"] = 1; | |
| } | |
| return (int)Session["WeekNumber"]; | |
| } | |
| set | |
| { | |
| Session["WeekNumber"] = value; | |
| } | |
| } | |
| DateTime lastWeekDay | |
| { | |
| get | |
| { | |
| if (Session["lastWeekDay"] == null) | |
| { | |
| Session["lastWeekDay"] = DateTime.MinValue; | |
| } | |
| return (DateTime)Session["lastWeekDay"]; | |
| } | |
| set | |
| { | |
| Session["lastWeekDay"] = value; | |
| } | |
| } | |
| public string Connection = "Data Source=62.197.41.101;Initial Catalog=PILOTWEBAPP;Persist Security Info=True;User ID=sa;Password=medularis"; | |
| public string strPropref; | |
| private int DayOfMonth; | |
| private string backgroundColor = String.Empty; | |
| private string backgroundColor1 = String.Empty; | |
| private string eventString = "Full"; | |
| private DateTime startDate; | |
| private DateTime endDate; | |
| protected void Page_Load(object sender, EventArgs e) | |
| { | |
| if (!Page.IsPostBack) | |
| { | |
| strPropref = Request.QueryString["Propref"]; | |
| // hide error message | |
| WebSchedule.Classes.General.ShowError(string.Empty, error_container, lblError); | |
| DayOfMonth = DateTime.UtcNow.Day; | |
| DateTime monthStartDate = (RadCalendar1.CalendarView as MonthView).MonthStartDate; | |
| weekNumber = GetLastWeekDayWeekNumber(DateTime.Today); | |
| PilotDataContext db = new PilotDataContext(Connection); | |
| var property = db.tbl_properties.Single(x => x.PROPREF == strPropref); | |
| RadTxtCustNo.Text = property.PROPREF; | |
| RadTxtCustName.Text = property.TENANT; | |
| RadTxtCustContact.Text = property.CONTACT; | |
| RadTxtCustContact1.Text = property.CONTACT2; | |
| lblAddress.Text = property.FULLADDRESS + " " + property.CONTRACT; | |
| txtcontract.Value = property.CONTRACT; | |
| RadCboOthers.Enabled = false; | |
| var Priority = from x in db.ltbl_order_priorities | |
| where x.CONTRACT == property.CONTRACT | |
| select new | |
| { | |
| x.PRIORITYCODE, | |
| x.CONTRACT, | |
| x.PRIORITYDESCRIPTION | |
| }; | |
| foreach (var orderpri in Priority) | |
| { | |
| // create list item | |
| Telerik.Web.UI.RadComboBoxItem pri = new Telerik.Web.UI.RadComboBoxItem(orderpri.PRIORITYDESCRIPTION, orderpri.PRIORITYCODE); | |
| // add to drop down | |
| RadCboPriority.Items.Add(pri); | |
| } | |
| var Origin = from x in db.ltbl_RepairOrigins | |
| where x.Contract == property.CONTRACT | |
| select new | |
| { | |
| x.RepairOrigin, | |
| x.IntCostCode, | |
| x.Contract | |
| }; | |
| foreach (var OrderOrg in Origin) | |
| { | |
| // create list item | |
| Telerik.Web.UI.RadComboBoxItem org = new Telerik.Web.UI.RadComboBoxItem(OrderOrg.RepairOrigin, OrderOrg.RepairOrigin); | |
| // add to drop down | |
| RadCboOrigin.Items.Add(org); | |
| } | |
| var Appliance = from x in db.tbl_appliances | |
| where x.propref == strPropref & | |
| x.removedate == null | |
| select x; | |
| foreach (var app in Appliance) | |
| { | |
| // create list item | |
| Telerik.Web.UI.RadComboBoxItem a = new Telerik.Web.UI.RadComboBoxItem(app.model, app.appliancecodeId); | |
| // add to drop down | |
| RadCboAppliance.Items.Add(a); | |
| } | |
| // create list item | |
| Telerik.Web.UI.RadComboBoxItem b = new Telerik.Web.UI.RadComboBoxItem("Not In List"); | |
| // add to drop down | |
| RadCboAppliance.Items.Add(b); | |
| var type = from x in db.ltbl_appliance_types select x; | |
| foreach (var t in type) | |
| { | |
| // create list item | |
| Telerik.Web.UI.RadComboBoxItem a = new Telerik.Web.UI.RadComboBoxItem(t.description, t.description); | |
| // add to drop down | |
| RadCboOthers.Items.Add(a); | |
| } | |
| } | |
| } | |
| public void GetData() | |
| { | |
| lblAddress.Visible = true; | |
| DateTime date; | |
| if (RadCalendar1.SelectedDate == Convert.ToDateTime("01/01/0001")) | |
| { | |
| date = DateTime.UtcNow; | |
| } | |
| else | |
| { | |
| date = RadCalendar1.SelectedDate; | |
| } | |
| //strPropref = Request.QueryString["Propref"]; | |
| SqlConnection conn = new SqlConnection(Connection); | |
| SqlCommand cmd = new SqlCommand("slot_sp_EngineerTimeslots2", conn); | |
| cmd.CommandType = CommandType.StoredProcedure; | |
| cmd.Parameters.AddWithValue("@PROPREF", RadTxtCustNo.Text); | |
| cmd.Parameters.AddWithValue("@iSTARTDATE", date); | |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); | |
| cmd.Parameters.AddWithValue("@TIMESLOT", RadAppointment.SelectedValue); | |
| cmd.Parameters.AddWithValue("@TIMEZONE", "ALL"); | |
| cmd.Parameters.AddWithValue("@ENGINEER", "ALL"); | |
| conn.Open(); | |
| SqlDataReader reader = cmd.ExecuteReader(); | |
| DataTable dt = new DataTable(); | |
| dt.Load(reader); | |
| dt.DefaultView.Sort = "Distance ASC"; | |
| RadGrid1.DataSource = dt; | |
| reader.Close(); | |
| conn.Close(); | |
| } | |
| protected override void OnPreRender(EventArgs e) | |
| { | |
| base.OnPreRender(e); | |
| startDate = ((MonthView)RadCalendar1.CalendarView).MonthStartDate; | |
| endDate = ((MonthView)RadCalendar1.CalendarView).MonthEndDate; | |
| } | |
| protected void CustomizeDay(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) | |
| { | |
| DateTime CurrentDate = e.Day.Date; | |
| backgroundColor1 = Color.Red.Name; | |
| backgroundColor = Color.Green.Name; | |
| TableCell currentCell = e.Cell; | |
| if (CurrentDate.Month == endDate.Month) | |
| { | |
| if (CurrentDate.Day == DayOfMonth) | |
| { | |
| currentCell = e.Cell; | |
| currentCell.Style["background-color"] = backgroundColor; | |
| currentCell.Visible = true; | |
| } | |
| } | |
| } | |
| private bool ValidRepair(string strcustNo, | |
| string strFault, | |
| string strCustName, | |
| string strCustContact, | |
| string strEngineer, | |
| string strTime, | |
| DateTime date, | |
| string priority) | |
| { | |
| // validate | |
| string strError = string.Empty; | |
| if (strcustNo.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Number."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strFault.Length == 0) | |
| { | |
| strError = "You must enter a valid Fault."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strCustName.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Name."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strCustContact.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Contact Number."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strEngineer.Length == 0) | |
| { | |
| strError = "You must Select an Engineer."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strTime.Length == 0) | |
| { | |
| strError = "You must Select a Date."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (date.ToLongDateString() == "01/01/0001") | |
| { | |
| strError = "You must Select a Date on the Calendar."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (priority.Length == 0) | |
| { | |
| strError = "You must Select a Priority."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| // success | |
| return true; | |
| } | |
| private bool ValidRepair(string strcustNo, | |
| string strFault, | |
| string strCustName, | |
| string strCustContact) | |
| { | |
| // validate | |
| string strError = string.Empty; | |
| if (strcustNo.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Number."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strFault.Length == 0) | |
| { | |
| strError = "You must enter a valid Fault."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strCustName.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Name."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| if (strCustContact.Length == 0) | |
| { | |
| strError = "You must enter a valid Customer Contact Number."; | |
| WebSchedule.Classes.General.ShowError(strError, error_container, lblError); | |
| return false; | |
| } | |
| // success | |
| return true; | |
| } | |
| public DateTime sortTravelTime() | |
| { | |
| DateTime date; | |
| if (RadCalendar1.SelectedDate == Convert.ToDateTime("01/01/0001")) | |
| { | |
| date = DateTime.UtcNow; | |
| } | |
| else | |
| { | |
| date = RadCalendar1.SelectedDate; | |
| } | |
| //strPropref = Request.QueryString["Propref"]; | |
| SqlConnection conn = new SqlConnection(Connection); | |
| SqlCommand cmd = new SqlCommand("slot_sp_EngineerTimeslots2", conn); | |
| cmd.CommandType = CommandType.StoredProcedure; | |
| cmd.Parameters.AddWithValue("@PROPREF", RadTxtCustNo.Text); | |
| cmd.Parameters.AddWithValue("@iSTARTDATE", date); | |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); | |
| cmd.Parameters.AddWithValue("@TIMESLOT", RadAppointment.SelectedValue); | |
| cmd.Parameters.AddWithValue("@TIMEZONE", "ALL"); | |
| cmd.Parameters.AddWithValue("@ENGINEER", txtEngineer.Value); | |
| conn.Open(); | |
| SqlDataReader reader = cmd.ExecuteReader(); | |
| DataTable dt = new DataTable(); | |
| dt.Load(reader); | |
| dt.DefaultView.Sort = "Distance ASC"; | |
| reader.Close(); | |
| conn.Close(); | |
| string engineer = txtEngineer.Value; | |
| string time = txtTime.Value; | |
| foreach (DataRow dr in dt.Rows) | |
| { | |
| if (dr["Engineer"].ToString() == engineer & dr["TimeZone"].ToString() == time) | |
| { | |
| date = DateTime.Parse(dr["BookedFromTime"].ToString()); | |
| } | |
| } | |
| return date; | |
| } | |
| protected void btnAdd_Click(object sender, EventArgs e) | |
| { | |
| // strPropref = Request.QueryString["Propref"]; | |
| PilotDataContext db = new PilotDataContext(Connection); | |
| var property = db.tbl_properties.Single(x => x.PROPREF == RadTxtCustNo.Text); | |
| int? i = 0; | |
| string ename = ""; | |
| string epayroll = ""; | |
| string eng = ""; | |
| eng = txtEngineer.Value; | |
| var engineer = db.sp_EngineerDetails(eng); | |
| foreach (var en in engineer) | |
| { | |
| ename = en.ENGINEER; | |
| epayroll = en.PayRollNumber; | |
| } | |
| string time = ""; | |
| if (txtTime.Value == "08-10") | |
| { | |
| time = "08:00"; | |
| } | |
| else if (txtTime.Value == "10-12") | |
| { | |
| time = "10:00"; | |
| } | |
| else if (txtTime.Value == "12-14") | |
| { | |
| time = "12:00"; | |
| } | |
| else if (txtTime.Value == "14-16") | |
| { | |
| time = "14:00"; | |
| } | |
| else if (txtTime.Value == "16-18") | |
| { | |
| time = "16:00"; | |
| } | |
| DateTime DateTimeValue = sortTravelTime(); | |
| string Appliance; | |
| if (RadCboAppliance.SelectedValue == "Not In List") | |
| { | |
| Appliance = RadCboOthers.SelectedValue; | |
| } | |
| else | |
| { | |
| Appliance = RadCboAppliance.SelectedValue; | |
| } | |
| DateTime date; | |
| if (RadCalendar1.SelectedDate == Convert.ToDateTime("01/01/0001")) | |
| { | |
| date = DateTime.UtcNow; | |
| } | |
| else | |
| { | |
| date = RadCalendar1.SelectedDate; | |
| } | |
| if (radyesno.SelectedValue == "Yes") | |
| { | |
| if (ValidRepair(RadTxtCustNo.Text, RadTxtFault.Text, RadTxtCustName.Text, RadTxtCustContact.Text, txtEngineer.Value, txtTime.Value, RadCalendar1.SelectedDate, RadCboPriority.SelectedValue) == false) | |
| { | |
| return; | |
| } | |
| db.slot_sp_Repair_OrderNew(property.CONTRACT, RadTxtCustNo.Text, RadCboPriority.SelectedValue, RadCboOrigin.SelectedValue, RadTxtCustNo.Text, RadTxtFault.Text, | |
| Appliance, radTxtAccess.Text, radTxtKeyAt.Text, DateTime.UtcNow, "", chkChargeable.Checked, ref i); | |
| lblOut.Text = i.ToString(); | |
| slot_tbl_Schedule slot = new slot_tbl_Schedule | |
| { | |
| OrderID = int.Parse(lblOut.Text), | |
| FromTime = DateTimeValue, | |
| ToTime = DateTimeValue.AddMinutes(30), | |
| BookedDate = DateTime.UtcNow, | |
| BookedToDate = RadCalendar1.SelectedDate.Date, | |
| AppointmentType = "Repair", | |
| Engineer = ename, | |
| payrollid = epayroll, | |
| PROPREF = property.PROPREF, | |
| JobMins = 30, | |
| }; | |
| db.slot_tbl_Schedules.InsertOnSubmit(slot); | |
| try | |
| { | |
| db.SubmitChanges(); | |
| } | |
| catch | |
| { | |
| Response.Redirect("Overview.aspx?OrderID=" + lblOut.Text + "&Timeslot=" + txtTime.Value); | |
| } | |
| if (txtTravel.Value.Length == 0) | |
| { | |
| //do Nothing | |
| } | |
| else | |
| { | |
| int mins = int.Parse(txtTravel.Value); | |
| DateTimeValue = sortTravelTime(); | |
| slot = new slot_tbl_Schedule | |
| { | |
| OrderID = int.Parse(lblOut.Text), | |
| FromTime = DateTimeValue, | |
| ToTime = DateTimeValue.AddMinutes(mins), | |
| BookedDate = DateTime.UtcNow, | |
| BookedToDate = RadCalendar1.SelectedDate.Date, | |
| AppointmentType = "TravelTime", | |
| Engineer = ename, | |
| payrollid = epayroll, | |
| PROPREF = property.PROPREF, | |
| JobMins = mins, | |
| }; | |
| db.slot_tbl_Schedules.InsertOnSubmit(slot); | |
| db.SubmitChanges(); | |
| } | |
| } | |
| else | |
| { | |
| if (ValidRepair(RadTxtCustNo.Text, RadTxtFault.Text, RadTxtCustName.Text, RadTxtCustContact.Text) == false) | |
| { | |
| return; | |
| } | |
| db.slot_sp_Repair_OrderNew(property.CONTRACT, RadTxtCustNo.Text, RadCboPriority.SelectedValue, RadCboOrigin.SelectedValue, RadTxtCustNo.Text, RadTxtFault.Text, | |
| Appliance, radTxtAccess.Text, radTxtKeyAt.Text, DateTime.UtcNow, "", chkChargeable.Checked, ref i); | |
| lblOut.Text = i.ToString(); | |
| } | |
| Response.Redirect("Overview.aspx?OrderID=" + lblOut.Text +"&Timeslot="+txtTime.Value); | |
| } | |
| protected void btnClear_Click(object sender, EventArgs e) | |
| { | |
| RadTxtFault.Text = ""; | |
| } | |
| private int GetWeekNumberFromDate(DateTime date) | |
| { | |
| return | |
| RadCalendar1.Calendar.GetWeekOfYear(date, RadCalendar1.DateTimeFormat.CalendarWeekRule, | |
| RadCalendar1.DateTimeFormat.FirstDayOfWeek); | |
| } | |
| private int GetLastWeekDayWeekNumber(DateTime date) | |
| { | |
| int dayOfWeek = (int)date.DayOfWeek; | |
| return GetWeekNumberFromDate(date.AddDays(6 - dayOfWeek)); | |
| } | |
| protected void RadAppointment_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) | |
| { | |
| } | |
| protected void RadCboPriority_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) | |
| { | |
| //this needs to run an if statement that determines the days needed for the calendar | |
| //depending on what the priority is. | |
| TableCell currentCell = new TableCell(); | |
| RadCalendarDay day = new RadCalendarDay(RadCalendar1); | |
| MonthView view = new MonthView(RadCalendar1); | |
| DayOfMonth = DateTime.Today.Day; | |
| int current = DateTime.Today.Day; | |
| string Connection = "Data Source=62.197.41.101; Initial Catalog=PilotWebApp; User ID=sa; Pwd=medularis;"; | |
| //strPropref = Request.QueryString["Propref"]; | |
| SqlConnection conn = new SqlConnection(Connection); | |
| SqlCommand cmd = new SqlCommand("Slot_sp_EngineerTimeslots_Group", conn); | |
| cmd.CommandType = CommandType.StoredProcedure; | |
| cmd.Parameters.AddWithValue("@PROPREF", RadTxtCustNo.Text); | |
| cmd.Parameters.AddWithValue("@PRIORITYCODE", RadCboPriority.SelectedValue); | |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); | |
| cmd.Parameters.AddWithValue("@TIMESLOT", RadAppointment.SelectedValue); | |
| conn.Open(); | |
| SqlDataReader reader = cmd.ExecuteReader(); | |
| DataTable dt = new DataTable(); | |
| dt.Load(reader); | |
| DayOfMonth = DateTime.Today.Day; | |
| int rows = dt.Rows.Count -1; | |
| startDate = DateTime.Today; | |
| endDate = startDate.Date.AddDays(rows); | |
| int endMonth = endDate.Month; | |
| while (startDate.Date <= endDate.Date) | |
| { | |
| RadCalendarDay specialDay = new RadCalendarDay(); | |
| specialDay.Date = startDate; | |
| specialDay.ItemStyle.BackColor = Color.Green; | |
| specialDay.ToolTip = "Available"; | |
| RadCalendar1.SpecialDays.Add(specialDay); | |
| startDate = startDate.AddDays(1); | |
| } | |
| } | |
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) | |
| { | |
| GetData(); | |
| } | |
| protected void RadGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e) | |
| { | |
| DateTime date; | |
| if (RadCalendar1.SelectedDate == Convert.ToDateTime("01/01/0001")) | |
| { | |
| date = DateTime.UtcNow; | |
| } | |
| else | |
| { | |
| date = RadCalendar1.SelectedDate; | |
| } | |
| string Connection = "Data Source=62.197.41.101; Initial Catalog=PilotWebApp; User ID=sa; Pwd=medularis;"; | |
| //strPropref = Request.QueryString["Propref"]; | |
| SqlConnection conn = new SqlConnection(Connection); | |
| SqlCommand cmd = new SqlCommand("slot_sp_EngineerTimeslots2", conn); | |
| cmd.CommandType = CommandType.StoredProcedure; | |
| cmd.Parameters.AddWithValue("@PROPREF", RadTxtCustNo.Text); | |
| cmd.Parameters.AddWithValue("@iSTARTDATE", date); | |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); | |
| cmd.Parameters.AddWithValue("@TIMESLOT", RadAppointment.SelectedValue); | |
| cmd.Parameters.AddWithValue("@TIMEZONE", "ALL"); | |
| cmd.Parameters.AddWithValue("@Engineer", "ALL"); | |
| conn.Open(); | |
| SqlDataReader reader = cmd.ExecuteReader(); | |
| DataTable dt = new DataTable(); | |
| dt.Load(reader); | |
| DataTable dt2 = dt.Clone(); | |
| foreach (DataRow dr1 in dt.Rows) | |
| { | |
| string AptType = dr1["AppointmentType"].ToString(); | |
| if (AptType == "FreeTime") | |
| { | |
| dt2.ImportRow(dr1); | |
| } | |
| } | |
| dt2.DefaultView.Sort = "Distance ASC"; | |
| RadGrid2.DataSource = dt2; | |
| reader.Close(); | |
| conn.Close(); | |
| } | |
| protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e) | |
| { | |
| GetData(); | |
| } | |
| protected void RadCboAppliance_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) | |
| { | |
| if (RadCboAppliance.SelectedValue == "Not In List") | |
| { | |
| RadCboOthers.Visible = true; | |
| } | |
| } | |
| protected void RadCboOrigin_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) | |
| { | |
| PilotDataContext db = new PilotDataContext(Connection); | |
| strPropref = Request.QueryString["Propref"]; | |
| var property = db.tbl_properties.Single(x => x.PROPREF == strPropref); | |
| var charge = from x in db.ltbl_RepairOrigins | |
| select x; | |
| foreach (var c in charge) | |
| { | |
| if (c.RepairOrigin == RadCboOrigin.SelectedValue & c.Contract == property.CONTRACT & c.ChargeReq == true) | |
| { | |
| chkChargeable.Checked = true; | |
| } | |
| else | |
| { | |
| chkChargeable.Checked = false; | |
| } | |
| } | |
| } | |
| } | |
| } | |
At the moment none of the above is able to be done and it is holding us back on the project that we are using the toolkit for
0
Hello Kevin,
RadCalendar1's SelectionChanged event, I believe, is supposed to bind RadGrid. You can note, however that you are calling the GetData() method, but you are not actually rebinding RadGrid. You need to call RadGrid's Rebind() method instead, as this method fires RadGrid's NeedDataSource event, where you get your data, and then binds RadGrid to the data. Generally speaking, whenever you define RadGrid's data source using the NeedDataSource event handler, you need to call RadGrid's Rebind() method when you want to refresh and rebind RadGrid.
For RadCalendar, you can clear the selected days using SpecialDays.Clear() method and then add new RadCalendarDay objects to its special days collection. You can do this, for example, in a button's click event, or other user-generated events.
Kind regards,
Veli
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
RadCalendar1's SelectionChanged event, I believe, is supposed to bind RadGrid. You can note, however that you are calling the GetData() method, but you are not actually rebinding RadGrid. You need to call RadGrid's Rebind() method instead, as this method fires RadGrid's NeedDataSource event, where you get your data, and then binds RadGrid to the data. Generally speaking, whenever you define RadGrid's data source using the NeedDataSource event handler, you need to call RadGrid's Rebind() method when you want to refresh and rebind RadGrid.
For RadCalendar, you can clear the selected days using SpecialDays.Clear() method and then add new RadCalendarDay objects to its special days collection. You can do this, for example, in a button's click event, or other user-generated events.
Kind regards,
Veli
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.