Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
358 views
Hi,

I have a RadGrid and I fill my data on it. First time i can filter my column but second time it gives "Cannot call method '_showFilterMenu' of null " message when i click filter button. My codes is follow..

and i attached my screenshot result..
 

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>




Andrey
Telerik team
 answered on 21 Jun 2012
8 answers
374 views
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> 

 

 

 

 

 

 

 

 


Thanks
Sushil Jinder
Princy
Top achievements
Rank 2
 answered on 21 Jun 2012
0 answers
98 views
HI,
I have a radgrid, a search button and tetxbox to enter my search term in and a table in db with like 50,000 records.
I ajaxified my grid which means that during paging I get to see this whirly on the screen and it all looks good. My question is that what happens for the first time when I enter the key and hit the search button. Right now my grid does not appear and there is no indication on the grid as if it is waiting for the data...any comments or ideas...? ANy help would be appreciated..

Thanks.
Sadi
Top achievements
Rank 1
 asked on 20 Jun 2012
5 answers
154 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
183 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
157 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
364 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
94 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
83 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
76 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?