or
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Getron.AAM.EntityManagement;using System.Data;using Telerik.Web.UI;using Getron.Core.BussinesRuleEngine;using Getron.Core.Base.Web;using System.Text;public partial class Sections_TaskManagement_Controls_SelectRows : EntityProtectedUserControl{ private void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString["ControlIntCode"] != null && Getron.Core.Tools.DataTableFieldOperation.ToInt64(Request.QueryString["ControlIntCode"].ToString(), 0) > 0) { RequestTemplateControl templateControl = new RequestTemplateControl(Getron.Core.Tools.DataTableFieldOperation.ToInt64(Request.QueryString["ControlIntCode"].ToString(), 0)); SqlDataSource1.ConnectionString = templateControl.DbSession.Connection.ConnectionString; SqlDataSource1.SelectCommand = templateControl.Query; this.RadGrid1.MasterTableView.Columns.Clear(); GridClientSelectColumn selectCol = new GridClientSelectColumn(); this.RadGrid1.MasterTableView.Columns.Add(selectCol); } }}<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SelectRows.ascx.cs" Inherits="Sections_TaskManagement_Controls_SelectRows" %> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Hay" /> <script type="text/javascript"> function GetRadWindow() { var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; return oWindow; } function returnToParent() { //create the argument that will be returned to the parent page var oArg = new Object(); //get the city's name oArg.cityName = "deneme"; //get the selected date from RadDatePicker //oArg.selDate = datePicker.get_selectedDate().toLocaleDateString(); //get a reference to the current RadWindow var oWnd = GetRadWindow(); //Close the RadWindow and send the argument to the parent page if (oArg.selDate && oArg.cityName) { oWnd.close(oArg); } } </script> <telerik:RadGrid AutoGenerateColumns="true" ID="RadGrid1" DataSourceID="SqlDataSource1" EnableTheming="true" Width="760px" AllowFilteringByColumn="True" AllowSorting="True" PageSize="15" ShowFooter="True" AllowPaging="True" runat="server" GridLines="None" EnableLinqExpressions="false"> <PagerStyle Mode="NextPrevAndNumeric" /> <GroupingSettings CaseSensitive="false" /> <MasterTableView AllowFilteringByColumn="True" ShowFooter="True" TableLayout="Auto"></MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> </ClientSettings> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource1" ProviderName="System.Data.SqlClient" runat="server"> </asp:SqlDataSource> <hr /> <button title="Submit" id="close" onclick="returnToParent(); return false;">Seçilenleri Onayla</button>| Hi, I am using the RADCombo. As per the requirement I have to format(Red color in my example) some items in the combobox based on some conditions.Formatting is done absolutely fine, but I face problem when the formatted item is selected. If a non-formatted item is selected then no issues, BUT if the user selects the formatted item, the formatting is not displayed but it simply shows the item without any format e.g. without any color in this case. I attach the simple code snipptes for your refence. please do the needful. protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| LoadData(); |
| } |
| } |
| private void LoadData() |
| { |
| // Add 1st Item |
| Telerik.Web.UI.RadComboBoxItem aItem; |
| aItem = new Telerik.Web.UI.RadComboBoxItem("Item2-invalid", "1"); |
| aItem.Attributes.Add("style", "background-color: ORANGERED"); //Make the back color Red |
| aItem.ToolTip = "Invalid"; |
| ddl1.Items.Add(aItem); |
| // Add 2nd Item |
| aItem = new Telerik.Web.UI.RadComboBoxItem("Item1", "2"); |
| ddl1.Items.Add(aItem); |
| // Add 3rd Item |
| aItem = new Telerik.Web.UI.RadComboBoxItem("Item3", "3"); |
| ddl1.Items.Add(aItem); |
| // Add 4thItem |
| ddl1.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0")); |
| } |
| <form id="form1" runat="server"> |
| <div> |
| <VStars:ScriptManager ID="mgr1" runat="server"></VStars:ScriptManager> |
| <VStars:ComboBox ID="ddl1" runat="server"> |
| </VStars:ComboBox> |
| </div> |
| </form> |
<%@ 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; } }}