or
foreach (blah blah) { templateColumn = new GridTemplateColumn(); RadGrid1.MasterTableView.Columns.Add(templateColumn); templateColumn.ItemTemplate = new MyTemplate(blah); templateColumn.HeaderText = blah; }private class MyTemplate : ITemplate{ protected CheckBox chk; private string columnName; public MyTemplate(string columnName) { this.columnName = columnName; } public void InstantiateIn(Control container) { chk = new CheckBox(); chk.ID = "chk" + columnName; chk.DataBinding += new EventHandler(DataBinding); chk.Enabled = true; container.Controls.Add(chk); } void DataBinding(object sender, EventArgs e) { CheckBox cBox = (CheckBox)sender; GridDataItem container = (GridDataItem)cBox.NamingContainer; cBox.Checked = (bool)((DataRowView)container.DataItem)[columnName]; }}Hi, i am trying to make a confirmation box when moving an appointment.
The problem here is that the:
args.get_targetSlot().get_startTime().format("HH:mm");
returns wrong time, wye is that?
function onAppointmentMoveEnd(sender, args) { var appointment = args.get_appointment(); var scheduler = $find("<%= RadScheduler1.ClientID %>"); var fromTime = appointment.get_start(); var customerName = appointment.get_resources().getResourceByType("Kunder").get_text(); var fromRoom = appointment.get_resources().getResourceByType("Rum").get_text(); var targetRoom = args.get_targetSlot().get_resource().get_text(); var targetTime = args.get_targetSlot().get_startTime().format("HH:mm"); // Calculate the duration of the appointment var appointmentDuration = appointment.get_end() - appointment.get_start(); var newFromEndTime = new Date(fromTime.getTime() + appointmentDuration); var editSeries = args.get_editingRecurringSeries(); // Pop a confirmation window var confirmMessage = "Är du säker på att du vill flytta " + customerName + "?<p> <strong> Från:</strong> " + fromRoom + " <strong>kl:</strong> " + fromTime.format("HH:mm") + "<br/> <strong>Till:</strong> " + targetRoom + " <strong>kl:</strong> " + targetTime + "</p>"; radconfirm(confirmMessage, function (arg) { if (arg == false) { // The user has confirmed moving the appointment. Update the start and end time. appointment.set_start(fromTime); appointment.set_end(newFromEndTime); scheduler.updateAppointment(appointment, editSeries); } }, 330, 100); }
ususing System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;using System.ComponentModel;public partial class Default5 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (Session["GridData"] == null) { DataTable table = GetTable(); Session.Add("GridData", table); } DefineGridStructure(); } private void DefineGridStructure() { RadGrid grid = new RadGrid(); grid.ID = "RadGrid1"; grid.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource); grid.AutoGenerateEditColumn = true; grid.AutoGenerateDeleteColumn = true; grid.AllowAutomaticInserts = true; grid.Width = Unit.Percentage(100); grid.PageSize = 15; grid.AllowPaging = true; grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric; grid.AutoGenerateColumns = false; grid.MasterTableView.Width = Unit.Percentage(100); grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom; grid.ItemInserted += grid_ItemInserted; grid.MasterTableView.DataKeyNames = new string[] { "RowNumber" }; GridBoundColumn boundColumn = new GridBoundColumn(); boundColumn.DataField = "RowNumber"; boundColumn.HeaderText = "RowNumber"; boundColumn.ReadOnly = true; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Size"; boundColumn.HeaderText = "Size"; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Description"; boundColumn.HeaderText = "Description"; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Quantity"; boundColumn.HeaderText = "Quantity"; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Duration"; boundColumn.HeaderText = "Duration"; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "DurationType"; boundColumn.HeaderText = "DurationType"; grid.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "Amount"; boundColumn.HeaderText = "Amount"; grid.MasterTableView.Columns.Add(boundColumn); PlaceHolder1.Controls.Add(grid); } private void grid_ItemInserted(object sender, GridInsertedEventArgs e) { RadGrid grid = (RadGrid)sender; int rowIndex = 0; if (Session["GridData"] != null) { DataTable dtCurrentTable = (DataTable)Session["GridData"]; DataRow drCurrentRow = null; if (dtCurrentTable.Rows.Count > 0) { for (int i = 0; i < dtCurrentTable.Rows.Count; i++) { GridEditFormInsertItem item = e.Item as GridEditFormInsertItem; TextBox box1 = item.FindControl("Size") as TextBox; TextBox box2 = item.FindControl("Description") as TextBox; TextBox box3 = item.FindControl("Quantity") as TextBox; TextBox box4 = item.FindControl("Unit") as TextBox; TextBox box5 = item.FindControl("Duration") as TextBox; TextBox box6 = item.FindControl("DurationType") as TextBox; TextBox box7 = item.FindControl("Amount") as TextBox; drCurrentRow = dtCurrentTable.NewRow(); drCurrentRow["RowNumber"] = i + 1; dtCurrentTable.Rows[i - 1]["Size"] = box1.Text; dtCurrentTable.Rows[i - 1]["Description"] = box2.Text; dtCurrentTable.Rows[i - 1]["Quantity"] = box3.Text; dtCurrentTable.Rows[i - 1]["Unit"] = box4.Text; dtCurrentTable.Rows[i - 1]["Duration"] = box5.Text; dtCurrentTable.Rows[i - 1]["DurationType"] = box6.Text; dtCurrentTable.Rows[i - 1]["Amount"] = box7.Text; rowIndex++; } dtCurrentTable.Rows.Add(drCurrentRow); Session["GridData"] = dtCurrentTable; grid.DataSource = Session["GridData"]; grid.Rebind(); } } } void grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { DataTable current = (DataTable)Session["GridData"]; RadGrid grid = (RadGrid)sender; grid.DataSource = current; } static DataTable GetTable() { // // Here we create a DataTable with a few columns. // // Create Datatable to store all colums DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("Size", typeof(string))); dt.Columns.Add(new DataColumn("Description", typeof(string))); dt.Columns.Add(new DataColumn("Quantity", typeof(string))); dt.Columns.Add(new DataColumn("Unit", typeof(string))); dt.Columns.Add(new DataColumn("Duration", typeof(string))); dt.Columns.Add(new DataColumn("DurationType", typeof(string))); dt.Columns.Add(new DataColumn("Amount", typeof(string))); dr = dt.NewRow(); dr["RowNumber"] = 1; dr["Size"] = string.Empty; dr["Description"] = string.Empty; dr["Quantity"] = string.Empty; dr["Unit"] = string.Empty; dr["Duration"] = string.Empty; dr["DurationType"] = string.Empty; dr["Amount"] = string.Empty; dt.Rows.Add(dr); return dt; }}
// RadTextBoxRadNumericTextBox rntb = new RadNumericTextBox();rntb.NumberFormat.PositivePattern = "n%";rntb.NumberFormat.DecimalDigits = 0;rntb.MinValue = 0;rntb.MaxValue = 100;rntb.Text = 50; // Displays as "50%"// How do I get "50%" into a label?Label lbl = new Label();lbl.Text = rntb.Text; // Only shows "50". I want to show "50%"
RadGridOperators.MasterTableView.IsItemInserted = false;e.Canceled = true;RadGridOperators.MasterTableView.ClearEditItems();RadGridOperators.MasterTableView.Rebind();
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"> </telerik:RadWindowManager> <telerik:RadWindow ID="radwindowPopup" runat="server" Animation="FlyIn" CssClass="modalPopup" DestroyOnClose="true" EnableShadow="true" IconUrl="~/Images/Bi.ico" KeepInScreenBounds="true" Width="420px" Height="150px" MaxHeight="150px" MaxWidth="420px" MinHeight="150px" MinWidth="420px" Modal="true" RenderMode="Classic" VisibleStatusbar="true" VisibleTitlebar="true" Behaviors="Close" Title="Manifest-BI" Skin="Web20"> <ContentTemplate> <center> <div style="padding: 20px"> Are you sure you want to Delete this Record? <br /> <br /> <telerik:RadButton ID="btnOk" runat="server" Text="Yes" Width="70px" OnClick="btnOk_Click" Skin="Web20" /> <telerik:RadButton ID="btnCancel" runat="server" Text="No" Width="70px" OnClick="btnCancel_Click" Skin="Web20" /> </div> </center> </ContentTemplate> </telerik:RadWindow>