or
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Client/ClientPortal.master" CodeBehind="Summary.aspx.vb" Inherits="WorkNotifications.ClientSummary" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeaderTopPlaceholder" runat="server"> <style type="text/css">a.HyperLink1{color:#57A6DC !important; font-style:italic;}</style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainPlaceholder" runat="server"> There are currently <ul> <li id="btPending"><asp:Label ID="lblPending" runat="server" Text="# Pending Work Notifications"></asp:Label></li> <li id="btApproved"><asp:Label ID="lblApproved" runat="server" Text="# Approved Work Notifications"></asp:Label></li> <li id="btCompleted"><asp:Label ID="lblCompleted" runat="server" Text="# Completed Work Notifications"></asp:Label></li> </ul> <telerik:RadScheduler TimelineView-UserSelectable="False" runat="server" ID="RadScheduler1" TimeZoneOffset="00:00:00" SelectedView="MonthView" OverflowBehavior="Expand" DataSourceID="sqlSummary" DataKeyField="WN_ID" DataStartField="StartDate" DataEndField="EndDate" DataSubjectField="SubjectField" DayStartTime="8:00:00" DayEndTime="17:00:00" AllowDelete="false" AllowEdit="false" AllowInsert="False" Skin="Web20" DataDescriptionField="WN_Status"> <AdvancedForm Modal="true" /> <Reminders Enabled="true" /> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler> <asp:SqlDataSource ID="sqlSummary" runat="server" ConnectionString="<%$ ConnectionStrings:WorkNotificationConnectionString %>" SelectCommand="SELECT WN_ID, WN_Status, CONVERT(varchar, dbo.WorkNotifications.DisplayID) + CASE iteration WHEN 0 THEN '' ELSE ' rev. ' + CONVERT(varchar, Iteration) END + ': ' + dbo.WorkNotifications.Description + ' (' + dbo.WN_Status.WNS_Status + ')' AS SubjectField, ApproveByDateTime as StartDate, dateadd(day, 1, ApproveByDateTime) as EndDate FROM dbo.WorkNotifications LEFT OUTER JOIN dbo.WN_Status ON dbo.WorkNotifications.WN_Status = dbo.WN_Status.WNS_ID WHERE (DLBClientID = '2') AND (WN_Status = 3) AND (ArchivedForRevision = 0) UNION SELECT WN_ID, WN_Status, CONVERT(varchar, dbo.WorkNotifications.DisplayID) + CASE iteration WHEN 0 THEN '' ELSE ' rev. ' + CONVERT(varchar, Iteration) END + ': ' + dbo.WorkNotifications.Description + ' (' + dbo.WN_Status.WNS_Status + ')' AS SubjectField, WorkStartDate as StartDate, dateadd(day, 1, WorkEndDate) as EndDate FROM dbo.WorkNotifications LEFT OUTER JOIN dbo.WN_Status ON dbo.WorkNotifications.WN_Status = dbo.WN_Status.WNS_ID WHERE (DLBClientID = '2') AND (WN_Status = 5) AND (ArchivedForRevision = 0) UNION SELECT WN_ID, WN_Status, CONVERT(varchar, dbo.WorkNotifications.DisplayID) + CASE iteration WHEN 0 THEN '' ELSE ' rev. ' + CONVERT(varchar, Iteration) END + ': ' + dbo.WorkNotifications.Description + ' (' + dbo.WN_Status.WNS_Status + ')' AS SubjectField, DATEADD(dd, DATEDIFF(dd, 0, CompletedDate), 0) as StartDate, dateadd(day, 1, DATEADD(dd, DATEDIFF(dd, 0, CompletedDate), 0)) as EndDate FROM dbo.WorkNotifications LEFT OUTER JOIN dbo.WN_Status ON dbo.WorkNotifications.WN_Status = dbo.WN_Status.WNS_ID WHERE (DLBClientID = '2') AND (WN_Status = 6) AND (ArchivedForRevision = 0)"> </asp:SqlDataSource> </asp:Content>Imports System.Data.SqlClient Imports System.Drawing Public Class ClientSummary Inherits System.Web.UI.Page Private Sub ClientSummary_Load(sender As Object, e As System.EventArgs) Handles Me.Load Session("UserType") = "Client" Using connection As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("WorkNotificationConnectionString").ConnectionString) Dim cmd As New SqlCommand() cmd.Connection = connection cmd.Connection.Open() cmd.CommandText = "SELECT COUNT(dbo.WorkNotifications.WN_ID) AS Total, dbo.WN_Status.WNS_ClientMode " _ & "FROM dbo.WorkNotifications LEFT OUTER JOIN " _ & "dbo.WN_Status ON dbo.WorkNotifications.WN_Status = dbo.WN_Status.WNS_ID " _ & "WHERE (dbo.WorkNotifications.ArchivedForRevision = 0) AND (dbo.WorkNotifications.DLBClientID = '2') " _ & "GROUP BY dbo.WN_Status.WNS_ClientMode" Dim dr As SqlDataReader = cmd.ExecuteReader While dr.Read Select Case dr.Item("WNS_ClientMode") Case "Pending" If dr.Item("Total") = 1 Then lblPending.Text = "1 Pending Work Notification" Else lblPending.Text = dr.Item("Total") & " Pending Work Notifications" End If Case "Approved" If dr.Item("Total") = 1 Then lblApproved.Text = "1 Approved Work Notification" Else lblApproved.Text = dr.Item("Total") & " Approved Work Notifications" End If Case "Completed" If dr.Item("Total") = 1 Then lblCompleted.Text = "1 Completed Work Notification" Else lblCompleted.Text = dr.Item("Total") & " Completed Work Notifications" End If End Select End While dr.Close() End Using End Sub Private Sub RadScheduler1_AppointmentClick(sender As Object, e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler1.AppointmentClick Response.Redirect("../WN.aspx?WN_ID=" & e.Appointment.ID.ToString) End Sub Private Sub RadScheduler1_AppointmentDataBound(sender As Object, e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler1.AppointmentDataBound If e.Appointment.Description <> Nothing Then Select Case e.Appointment.Description.ToString Case 3 'Unapproved e.Appointment.BackColor = Color.Gold e.Appointment.BorderColor = Color.DarkGoldenrod Select Case e.Appointment.Description.ToString Case 3 e.Appointment.CssClass = "AppBackGround" End Select Exit Select Case 5 'DLB & Client Approved e.Appointment.BackColor = Color.PaleGreen e.Appointment.BorderColor = Color.DarkGreen Exit Select Case 6 'Completed e.Appointment.BackColor = Color.Gainsboro e.Appointment.ForeColor = Color.DimGray e.Appointment.BorderColor = Color.DarkGray Exit Select Case Else Exit Select End Select End If End SubEnd Classfunction OnClientUpdated(sender, args) { var value = sender.get_value(); if (value == 0) { sender.hide(); }}<telerik:RadNotification ID="notification" runat="server" Title="Incorrect Picking" ShowInterval="30000" KeepOnMouseOver="true" UpdateInterval="30000" AutoCloseDelay="5000" OnClientUpdating="OnClientUpdating" OnClientUpdated="OnClientUpdated" LoadContentOn="TimeInterval" ShowCloseButton="true" Width="250px" oncallbackupdate="notification_CallbackUpdate"> <ContentTemplate> <asp:Literal ID="ltlJob" runat="server"></asp:Literal> <asp:ImageButton ID="btnRefresh" runat="server" ImageUrl="~/Content/Images/refresh.png" OnClick="RefreshGrids" /> </ContentTemplate> </telerik:RadNotification> protected void notification_CallbackUpdate(object sender, Telerik.Web.UI.RadNotificationEventArgs e) { LMDBDataContext dc = new LMDBDataContext(); List<Job> jobs = //Get new jobs if (jobs.Count > 0) { notification.Value = "1"; ltlJob.Text = jobs.Count; } else { notification.Value = "0"; }}<telerik:RadScriptManager runat="server" ID="ScriptManager" /><asp:Button runat="server" ID="OpenButton" OnClick="OpenButton_Click" Text="Open Window" /><asp:Panel runat="server" ID="OutputPanel"> <asp:Literal runat="server" ID="OutputLiteral" /></asp:Panel><asp:Panel runat="server" ID="WindowWrapper"> <telerik:RadWindow runat="server" ID="Window" Behaviors="Move,Resize" VisibleStatusbar="false"> <ContentTemplate> <telerik:RadAjaxPanel runat="server" ID="WindowContentWrapper" EnableAJAX="true"> <asp:DropDownList runat="server" ID="TestDropdown" AutoPostBack="true"> <asp:ListItem Text="A" Value="A" /> <asp:ListItem Text="B" Value="B" /> <asp:ListItem Text="A and B" Value="AB" /> </asp:DropDownList> <asp:Panel runat="server" ID="PanelA" Visible="false"> You selected A </asp:Panel> <asp:Panel runat="server" ID="PanelB" Visible="false"> You selected B </asp:Panel> </telerik:RadAjaxPanel> <asp:Button runat="server" ID="CloseButton" OnClick="CloseButton_Click" Text="Close Window" /> </ContentTemplate> </telerik:RadWindow></asp:Panel>protected override void OnLoad(EventArgs e){ base.OnLoad(e); if (!IsPostBack) { this.TestDropdown.SelectedValue = "A"; }}protected override void OnPreRender(EventArgs e){ base.OnPreRender(e); this.PanelA.Visible = this.TestDropdown.SelectedValue.Contains('A'); this.PanelB.Visible = this.TestDropdown.SelectedValue.Contains('B');}protected void OpenButton_Click(object sender, EventArgs e){ //Do some server-side stuff first this.Window.VisibleOnPageLoad = true;}protected void CloseButton_Click(object sender, EventArgs e){ this.OutputLiteral.Text = string.Format("You selected {0}", this.TestDropdown.SelectedItem.Text); this.Window.VisibleOnPageLoad = false;}
Thank you
function CheckSelectedRows(strCtrlColumnName, strColumnName) { var gridType = 'GrdApplication'; var grid = $find(gridType); var MasterTable = grid.get_masterTableView(); var Rows = MasterTable.get_dataItems(); for (var i = 0; i < Rows.length; i++) { var cell = MasterTable.getCellByColumnUniqueName(Rows[i], strCtrlColumnName); var curRow = MasterTable.getCellByColumnUniqueName(Rows[i], strColumnName); if (Selectedvalue != '') { Selectedvalue = Selectedvalue + '\r\n' + curRow.innerHTML; } }}
I have a RadGrid on my page, and have the ReorderColumnsOnClient property set to true. This all works fine.
However, I also have a requirement to hide columns which are dragged *off* the grid.
Anybody have any ideas on how I might do this?
PS - I'd prefer to do this with the the regular Telerik events, as opposed to using undocumented functionality which might break on the next version.
Here's the prototype aspx I created.
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"></asp:Content><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> How do I detect a column has been dragged off the grid? </h2> <asp:ScriptManager runat="server" /> <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" GridLines="None"> <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"> </ClientSettings> <MasterTableView DataKeyNames="ProductID" DataSourceID="SqlDataSource1"> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="ProductID" DataType="System.Int32" HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" UniqueName="ProductName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" UniqueName="CategoryName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="UnitPrice" SortExpression="UnitPrice" UniqueName="UnitPrice"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="UnitsInStock" DataType="System.Int16" HeaderText="UnitsInStock" SortExpression="UnitsInStock" UniqueName="UnitsInStock"> </telerik:GridBoundColumn> </Columns> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [ProductID], [ProductName], [CategoryName], [UnitPrice], [UnitsInStock] FROM [Alphabetical list of products]"> </asp:SqlDataSource></asp:Content><add name="NorthwindConnectionString" connectionString="Data Source=.;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient" />
protected void GrdConfig_UpdateCommand(object sender, GridCommandEventArgs e) { Hashtable newValues = new Hashtable(); ((GridEditableItem)e.Item).ExtractValues(newValues); Alert.Show(newValues["ColumnName"].ToString()); ... Working SQL code ... }