Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
182 views
  • I am using MS Visual Studio 2010 in a 3.5 environment.
  • I am using Microsoft Vista (32 bit)
  • The database is currently located on an SQL 2005 server.
  • I am using RadGrid & tools, version 2012.1.411.35
  • I am using both Chrome (18.0.1025.168) and Internet Explorer (8.0.7600.16385)
  • I am programming in VB.net

I am usiing the radScheduler to display full day events that can last 1 or more days.  I am setting the background and border colors for the items based on content.  Where this is failing me is when the item continues to the next day.  When this happens, the border and background disappear.

This only fails in Month View.  In Day view the colors are there for each day.  Week view draws the appointment across all days.

The attached image shows this to be the case for items 52 & 53 which should last from Jun 8th to Jun 15th.  The database values driving the start and date are:

2012-06-08 00:00:00.000
2012-06-16 00:00:00.000

My Markup and code are below:

<%@ 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 Sub
End Class
Rick
Top achievements
Rank 1
 answered on 20 Jun 2012
2 answers
206 views
Hi, the RadNotification tool looks extremely useful for my application, but I am having some trouble understanding how to have it do what I want. I want to essentially perform a 'check' every 60 seconds, which will see if there are any new rows in a certain table. if there are, I want to tell the user and show them some details of this row - if not I don't want the notification to show.

Here's what I have currently:
function 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";  
            }
}

This 'sort of' works, but the notification pops up for a a very short time then disappears if the value is 0, when I want it to not show it at all.
Chris
Top achievements
Rank 1
 answered on 20 Jun 2012
0 answers
179 views
Hi:

I'd like to use RadGrid in a Web App that I'm building.  Is there a way that I can hide/show certain columns based on the width of the screen?  I currently use CSS to change the layout considerably when  the screen goes below a certain width - i.e.  @media only screen and (max-width: 850px)

Any suggestions would be greatly appreciated.

Roger
Roger
Top achievements
Rank 2
Veteran
 asked on 20 Jun 2012
3 answers
376 views
Hi everyone, 

Short description:  See the code below...  How do I make my RadWindow open and close via AJAX without breaking its ajaxified content? 


Long description:  

I have a RadWindow, an "Open Window" button, and a Literal.  The open button (no AJAX) opens the RadWindow by toggling its VisibleOnPageLoad property*.  

In the RadWindow, which uses ContentTemplate, there is a RadAjaxPanel and a "Close Window" button.  The close button (no AJAX) closes the RadWindow by toggling its VisibleOnPageLoad property*.  

*I do a server-side window open/close because I want to so some other server-side stuff on the button click event.   

The RadAjaxPanel contains a DropDownList and two Panels ("A" and "B").  The dropdown toggles the visibility of the two panels via AJAX.  When the Close button is clicked, the Literal's Text is changed to that of the dropdown's SelectedItem text.  

So, after the page posts...  

I click the Open Window button.  It does a full postback and the RadWindow is displayed.  I change the dropdown from "A" to "B".  It does an async postback, Panel A disappears, Panel B is displayed.  I click the Close button, it does a full postback, the window disappears, and the literal's text is changed to "You selected B".  

Now I want the RadWindow to open and close via AJAX, but all my attempts to get it working with RadAjaxManager have failed.  The technique for server side RadWindow open/close that I've been using breaks the RadWindow's content AJAX (it does a full postback when I change the dropdown).  

How do I make my RadWindow open and close via AJAX without breaking its ajaxified content?

Page markup:  
<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>

Page codebehind: 
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
Drew
Top achievements
Rank 1
 answered on 20 Jun 2012
0 answers
102 views
I've observed that spaces in text are being removed in my radGrid when retrieving using javascript. The spaces are present in the html, just not able to get the full data when I retrieve it. I'm using code similar to what is documented in Telerik documentation.
http://www.telerik.com/help/aspnet-ajax/grid-getting-cell-values-for-selected-rows-client-side.html

Specifically, I have text similar to "A  B", where there are two spaces between A and B, but code only returns 1 of the spaces. Is this a bug in Telerik javascript functions, or am I doing something wrong?

Snippet of code relevant to my issue is below.
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;
            }
        }
}

Ken O.
Top achievements
Rank 1
 asked on 20 Jun 2012
0 answers
130 views
I have a simple 2 column grid with startswith filters and a filterdelay set to 500. It works correctly as long as the grid is not in a Ajax Panel. Once it is in a Ajax panel. it will only sort on the first column selected.
Ken
Top achievements
Rank 1
 asked on 20 Jun 2012
1 answer
94 views
Hi there

I have run into the strangest problem.

I have two RadGrid's with NestedTemplates on two separate pages.

When I log in as my admin user they both work fine, but when I log in with a different user they don't want to expand?

The users are accessing the SAME pages, all that differs is one query that populates the MainTable in one of the grids. The second client page is EXACTLY the same regardless of the user logged in, but yet, they can't expand the Nested Rows?

I am totally confused and can't think of any reason this should be happening?
Jako
Top achievements
Rank 1
 answered on 20 Jun 2012
1 answer
75 views
I have a small grid that has AllowMultiRowSelection="false" and I have an OnRowDeselecting event handler which, for testing, simply calls eventArgs.set_cancel(true)

If I select a row by clicking on it, and then click another row to select it, both rows will be selected! This is improper behavior! If I add handlers for all of the de/selection events, I can see that, despite the fact that I have set multirow selection FALSE, and despite the fact that I cancelled the deselectin event, the selecting and selected events for the other row still fire, resulting in multiple rows selected!
Eyup
Telerik team
 answered on 20 Jun 2012
1 answer
67 views

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>

And the web.config's 
<add name="NorthwindConnectionString" connectionString="Data Source=.;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient" />


Eyup
Telerik team
 answered on 20 Jun 2012
3 answers
211 views
Hello,

I am using the ExtractValues method in my UpdateCommand method to retrieve a mapping of column names to values from an edited row. However, when I edit a row, the value mapped to its column stays the same in the hashtable, as well as in the grid. What could be the possible explanations for this?

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
     ...
}
Pavlina
Telerik team
 answered on 20 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?