Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
115 views
Hi

I am trying to leverage the c# code you have at the following url:

http://www.telerik.com/help/aspnet/grid/grdfilteringfordatetimecolumnwithdataformatstring.html

Whilst there are several syntax errors I have been able to overcome most of them,
but the following line has me stumped:

string currentPattern = (TextBox)filterItem(((Pair)e.CommandArgument).Second).Controls(0).Text;

I get an error which says.

'filterItem is a variable but it is used like a method'.

What is this line supposed to be?

In the process you might want to clean up the other syntax errors too.

TIA
Marin
Telerik team
 answered on 17 Jun 2011
3 answers
195 views
Hello,

I build a class with Telerik Advices to custom filter date.

My RadFilter bind a RadGrid.
I can save filters in a sqlDataBase.

When I choose a value in my custom combo filter date : no problem.
I save it : no problem
I load it the same day : no problem

But if I load it the next day or after : I must select the value, again.
It is very restriction for users which save their filters.
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports Telerik.Web.UI
Imports System.Collections  
  
'ACB - V1.0 - 07 septembre 2010
''' <summary>
''' filter on today or next days or last days''' </summary>
''' <remarks></remarks>
  
Public Class DateFiltre
    Inherits RadFilterDataFieldEditor
  
    Protected Overrides Sub CopySettings(ByVal baseEditor As Telerik.Web.UI.RadFilterDataFieldEditor)
        MyBase.CopySettings(baseEditor)
        Dim editor = TryCast(baseEditor, DateFiltre)
        If editor IsNot Nothing Then
            StartDate = editor.StartDate
         End If
    End Sub
  
    Public Property StartDate() As System.Nullable(Of DateTime)
        Get
            Return m_StartDate
        End Get
        Set(ByVal value As System.Nullable(Of DateTime))
            m_StartDate = value
        End Set
    End Property
    Private m_StartDate As System.Nullable(Of DateTime)
  
    Public Overrides Property DataType() As System.Type
        Get
            Return MyBase.DataType
        End Get
        Set(ByVal value As System.Type)
            MyBase.DataType = value
        End Set
    End Property
  
    Public Overrides Function ExtractValues() As System.Collections.ArrayList
        Dim list As New ArrayList()
        If combo.SelectedIndex = 0 Then
            list.Add(Nothing)
        Else            
            list.Add(DateTime.Parse(combo.SelectedValue))
        End If
        Return list
    End Function
    Private combo As RadComboBox
  
    Public Overrides Sub InitializeEditor(ByVal container As System.Web.UI.Control)        
        Dim currentDate = If(StartDate, Date.Today)
  
        combo = New RadComboBox()
        combo.Items.Add(New RadComboBoxItem("select"))
        combo.Items.Add(New RadComboBoxItem("date+60", currentDate.AddDays(60).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+21", currentDate.AddDays(21).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+20", currentDate.AddDays(20).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+15", currentDate.AddDays(15).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+14", currentDate.AddDays(14).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+10", currentDate.AddDays(10).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+7", currentDate.AddDays(7).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+5", currentDate.AddDays(5).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+2", currentDate.AddDays(2).ToString()))
        combo.Items.Add(New RadComboBoxItem("date+1", currentDate.AddDays(1).ToString()))
        combo.Items.Add(New RadComboBoxItem("date", currentDate.ToString()))
        combo.Items.Add(New RadComboBoxItem("date-1", currentDate.AddDays(-1).ToString()))
        combo.Items.Add(New RadComboBoxItem("date-2", currentDate.AddDays(-2).ToString()))
        combo.Items.Add(New RadComboBoxItem("date-3", currentDate.AddDays(-3).ToString()))
  
        container.Controls.Add(combo)
    End Sub
  
    Public Overrides Sub SetEditorValues(ByVal values As System.Collections.ArrayList)
        If values(0) IsNot Nothing Then
             combo.SelectedValue = values(0).ToString
        End If
    End Sub
End Class

Have you got an idea to find again my selected value ?

Anne
Anne
Top achievements
Rank 1
 answered on 17 Jun 2011
4 answers
122 views
Hi there,

Our users have come across a bug that only seems to effect IE (IE7 8 and 9 tested).

If you type the following over 3 lines:

line 1
line 2
line 3

Select it, then set its font size to say, 12px. So far so good. Now, with it still selected, turn it into a bulleted list. All 3 lines are put under one bullet point, and the following markup is produced:

<ul>
    <
li><span style="font-size: 12px;">line 1<br />
    line 2<br />

    line 3</
span></li>
</
ul>


Whereas, Firefox and Chrome both render:

<ul>
    <
li><span style="font-size: 12px;">line 1</span></li>
   
<li><span style="font-size: 12px;">line 2</span></li>
    <li><span style="font-size: 12px;">line 3</span></li>
</ul>


IE does it properly if you do it the opposite way, first a bullet list, then the font size.

I have just upgraded to Q3 2010 and the problem still exists.

Sorry if this is in the wrong area.

Regards,

RSPCA Victoria
Rumen
Telerik team
 answered on 17 Jun 2011
4 answers
116 views
I have a rather complex scenario.

I'm creating a set of coordinating User Controls that give me a tabbed interface where the tabs are Help, Search, Search Results, List, Edit, New, View, and some customizable functions.  I'm turning these into a fully ajaxified interface controlled by instantiated JavaScript objects in an external JS file so that I can have multiple interfaces on the same page that use this interface.  I have to say that this would be much, much more difficult without you guys at Telerik.

When I did this, I was able to instantiate a single interface on a page and it all worked perfectly.  Very snappy response since it's all Ajaxified.  So, for the next step, I took this interface and placed it in a RadWindow within a RadWindowManager so that I could utilize it in a desktop-like MDI interface like you have in the demos section.  When I did this, things started to go funky.  To start, I was getting postbacks on things like tab clicks, grid sorting and paging, and stuff like that.  I also noticed that the counts in the RadGrid pager were messed up.

To address this, I'm taking a step at a time in order to focus on a single problem with minimal complexity. 

I've been able to recreate a situation where I have a radGrid within a radWindow within a radWindowManager, and I'm ONLY calling set_virtualItemCount(5) in order to test updating the pager on the RadGrid.  When I load this page, it shows 21 items in 2 pages.  When I click the button to trigger the JavaScript, it remains at 21 items in 2 pages.

IF I REMOVE the RadWindowManager, and just have a standalone RadWindow, clicking the button changes the page count information to 5 items in 1 page.  And, of course, if I take out the RadWindow as well, clicking the button changes the page count to 5 items in 1 page.

Can you figure out what's going on here?

Here's my code.  It's all self-contained (no external JS file):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-us" >
<head id="Head1" runat="server">
    <meta http-equiv="Content-Language" content="en-us" />
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta name="description" id="PageDescription" runat="server" content="" />
    <meta name="keywords" id="PageKeywords" runat="server" content="" />
    <title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server" enableviewstate="true" method="post">
 
<telerik:RadScriptManager runat="server" ID="SM1">
    <Services>
        <asp:ServiceReference Path="~/TestServices.asmx" />
    </Services>
</telerik:RadScriptManager>
 
            <telerik:RadWindowManager ShowOnTopWhenMaximized="false" Skin="Web20" Width="590"
                    Height="360" Behaviors="Close,Maximize,Minimize,Move,Reload,Resize"
                    ID="RadWindowManager"
                    runat="server" EnableShadow="true">
                <Windows>
                    <telerik:RadWindow ID="VendorAdminWindow" runat="server" VisibleOnPageLoad="true" ShowContentDuringLoad="true" DestroyOnClose="false" Skin="Web20" Width="590" >
                        <ContentTemplate>
                            <asp:Button ID="Button1" Text="Load" runat="server" OnClientClick="return loadData()" />
                            <Telerik:radGrid
                                ID="ItemList"
                                runat="server"
                                AllowPaging="True"
                                PageSize="20"
                                PagerStyle-AlwaysVisible="true"
                                AllowSorting="True"
                                HorizontalAlign="NotSet"
                                AutoGenerateColumns="False"
                                Skin="WebBlue"
                                MasterTableView-Caption="Right-Click a row to access the Context-Sensitive Menu, Click Column Names to Sort"
                                Width="98%"
                            >
                            <MasterTableView
                                ClientDataKeyNames="ItemID_rin" AllowMultiColumnSorting="false"
                            >
                                <Columns>
                                    <Telerik:GridBoundColumn
                                        DataField="ItemID_rin"
                                        UniqueName="ItemID_rin"
                                        visible="false"
                                        HeaderText="Item ID"
                                    />
                                    <Telerik:GridBoundColumn
                                        DataField="FirstName_rst"
                                        UniqueName="FirstName_rst"
                                        HeaderText="First Name"
                                        ItemStyle-VerticalAlign="Top"
                                    />
                                    <Telerik:GridBoundColumn
                                        DataField="LastName_rst"
                                        UniqueName="LastName_rst"
                                        HeaderText="Last Name"
                                        ItemStyle-VerticalAlign="Top"
                                    />
                                    <Telerik:GridBoundColumn
                                        DataField="ForumHandle_rst"
                                        UniqueName="ForumHandle_rst"
                                        HeaderText="Handle"
                                        ItemStyle-VerticalAlign="Top"
                                    />
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>
                                <Selecting AllowRowSelect="true" />
                                <ClientEvents OnCommand="function(){}" />
                            </ClientSettings>
                            <PagerStyle
                                Mode="NextPrevAndNumeric"
                                Position="TopAndBottom"
                            />
                            </Telerik:radGrid>
 
                        </ContentTemplate>
                    </telerik:RadWindow>
                </Windows>
            </telerik:RadWindowManager>
 
            <script language="javascript" type="text/javascript">
 
                loadData = function () {
                    /********************************************************************************************\
                    |*                                                                                                                                                                                  *|
                    |*  loadData                                                                                                                                                                *|
                    |*                                                                                                                                                                                  *|
                    \********************************************************************************************/
 
                    Grid_aob = $find('<%= ItemList.ClientID %>');
                    var tableView = Grid_aob.get_masterTableView();
                    tableView.clearSelectedItems();
                    tableView.set_virtualItemCount(5);
                    alert('Counts should be updated to 5 items.');
                    return false;
 
                }
 
            </script>
 
</form>
</body>
</html>

I'm hoping, of course, that this uncovers the root of all of my problems with this solution.  I have to say that I don't have a 100% grasp on all of the details with the postbacks, but I clearly was able to reproduce this problem. 

I've tested this in Firefox 4.01, IE 9 (using modes for IE 8 and IE 9), Chrome 12.0.742.91, and safari 5.0.5.

Thanks for your assistance.
LeBear
Top achievements
Rank 1
 answered on 17 Jun 2011
1 answer
286 views
Hi,

I am using radlistbox item disable in server side. but i want enable client side while some value changed. but i am getting enable client side but the text has been shared(like disabled time). how to solve this problem,

Please let me know,


 Thanks,
Dhamu.
Shinu
Top achievements
Rank 2
 answered on 17 Jun 2011
1 answer
73 views
Hello,

I'm having a problem with RadWindow and RadDockZone, when the contents of RadDockZone is larger than the size of the RadWindow, in Internet Explorer 7, the RadDockZone overflows the RadWindow, creates the scroll bar, but the content overflow the RadWindow.

In real case I have in the RadWindow, one RadDockZone with some fields, and another below, with a RadGrid. But did this example that simulates the same problem:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptManager ID="telerik_ajax_manager" runat="server" OutputCompression="AutoDetect" />
 
    Overflow test: RadWindow + dockZone
 
    <telerik:RadWindow ID="rad_window" runat="server" Title="Overflow test: RadWindow + dockZone" Modal="true" Width="500px" Height="400px" Behaviors="Close"
        VisibleStatusbar="false" VisibleOnPageLoad="true">
        <ContentTemplate>
            <telerik:RadDockZone ID="dock_zone_1" runat="server" BorderStyle="None" >
                <telerik:RadDock ID="dock_1" runat="server" Title="Dock Zone 1" Resizable="false" EnableDrag="false" DefaultCommands="ExpandCollapse">
                    <ContentTemplate>
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                    </ContentTemplate>
                </telerik:RadDock>
            </telerik:RadDockZone>
            <telerik:RadDockZone ID="dock_zone_2" runat="server" BorderStyle="None" >
                <telerik:RadDock ID="dock_2" runat="server" Title="Dock Zone 2" Resizable="false" EnableDrag="false" DefaultCommands="ExpandCollapse">
                    <ContentTemplate>
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                        test <br />
                    </ContentTemplate>
                </telerik:RadDock>
            </telerik:RadDockZone>
        </ContentTemplate>
    </telerik:RadWindow>
</asp:Content>


Tested in FF3, FF4, IE7, IE8, IE9 and chrome. And the problem only occurs in IE7. I tried some solutions with css, but could not resolve satisfactorily.

It would be a bug? or just something that I'm setting wrong?
Marin Bratanov
Telerik team
 answered on 17 Jun 2011
4 answers
351 views
Hi

I have a somewhat complicated problem with z-ordering some of my UI elements.

The Site Master part of my page contains a RadMenu control, this has a z-index of 7000.

Elsewhere in my my page I have a docling area with several panels.

Originally when I undocked one of the panels I saw some controls bleeding through, because of
their higher z-index. My Site Master RadMenu was one of the problem controls, but so were
the Date and Time picker icons in a gris filter I have in part of my page.

So I decided to detect the undocking of my panel and bump its z-index to 7001.

This solved my problem.

Until!!!!!

I was then asked to put a grid in the dock area with filtering on a GridBoundColumn.

This shows a filter control that extends a dropdown when clicked.

Well this dropdown has a z-index less than 7001 so it appears behind my undocked area.

I thought this would be as simple as writting some jQuery in the doc ready function to tweak
the z-index of the dropdown, but either my selector is wrong or something else is preventing
me from affecting the z-index of the div you generate.

Help greatly appreaciated.
Tim
Top achievements
Rank 1
 answered on 17 Jun 2011
1 answer
124 views
Hi Telerik,

I noticed something weird going on with my code and I was wondering if there was a way to avoid this scenario.

When I create a RadDock I attach it to a RadDockZone via "RadDockZone.Controls.Add(dock)". This sets the RadDock's Parent to RadDockZone.

When I recreate a RadDock on Page_Init, I allowed the RadDockLayout to move the RadDock into place during RadDockLayout_LoadDockLayout. This sets the RadDock's parent to RadDockLayout.

Thus, this code is necessary and I would like to condense it into something more sensible:

//The dock's parent can change. When it is first created the dock's parent is the DockZone, but after
//recreation the dock's parent is RadDockLayout.
 
RadPane pane = null;
 
if (Parent.GetType() == typeof(CormantRadDockZone))
{
    pane = Parent.Parent as RadPane;
}
else
{
    RadDockLayout dockLayout = Parent as RadDockLayout;
    RadDockZone zone = dockLayout.RegisteredZones.Where(registeredZone => registeredZone.ID == DockZoneID).FirstOrDefault();
    pane = zone.Parent as RadPane;
}
 
try
{
    Chart.Height = new Unit(pane.Height.Value - 42, UnitType.Pixel);
    Chart.Width = new Unit(pane.Width.Value - 22, UnitType.Pixel);
}
catch (Exception ex)
{
    Logger.ErrorFormat("Unable to adjust chart dimensions. Reason: {0}", ex.Message);
}

Is my problem clear? How can I avoid this?
Pero
Telerik team
 answered on 17 Jun 2011
1 answer
85 views
 Hi, 

    i download the web mail demo source code, and create new application with help of downloaded file in my local system (Visual studio 3.5 SP1, SQL 2008). When i built the application, i received the "unrecongnized attribute 'targetFramework'.Note that attribute names are case-sensitive". Then, I found that your product(Web Mail) supports Framework 4.o. Now i changed to framework version to 4.0. 

But the error keeps coming up all the time.

Need help on this.

Thanks in advance,

Georgi Tunev
Telerik team
 answered on 17 Jun 2011
9 answers
357 views
Hello,

I am using Sitefinity 3.7 with RadControls (RadFilter and RadGrid).  By programmatically I am setting radfilter by giving filter string (eg. ([Val] = 2)) with the following code:

                   var eq = new RadFilterEqualToFilterExpression<string>(columnName);

                    RadFilter1.RootGroup.AddExpression(eq);
                    eq.Value = columnValue;

                    RadFilter1.RecreateControl();
                    RadFilter1.FireApplyCommand();

It's working fine when I am using this code on button clicks event and the output is like this code is set the filter (visually) in RadFilter and apply also.

The issue is when I am trying to execute this code on Page_Load under !IsPostBack block, I am getting the following exception:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 

 Line 418:
Line 419:            //displaying the conditions while recreate the control
Line 420:            RadFilter1.RecreateControl();
Line 421:
Line 422:            RadFilter1.FireApplyCommand();

Source File: c:\Program Files\telerik\Sitefinity3.7\WebSites\MySite\App_Code\clsBAL.cs    Line: 420 

Stack Trace: 

For this I try to use Page_LoadComplete event, but no luck, because we are using the usercontrol as:

public partial class UserControl_xanc_grid : System.Web.UI.UserControl
{
}

So, can you please suggest me how can I set the filter programmatically on page_load (after page load).

Thanks,
Varinder Kumar
Iana Tsolova
Telerik team
 answered on 17 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?