Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
198 views
Hello,

I am having an issue using a custom drop down editor in the rad filter. When I set the value of my first filter criteria and click the link to add more criteria I lose the value of the first criteria I set. I think the issue has to do with when the handler is added for setting the value is after the binding already takes place.

Thanks!

Don

MyRuntimeEditor.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyRuntimeEditor.aspx.vb" Inherits="MyRuntimeEditor" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Namespace="MyCustomEditors" TagPrefix="mycustom" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
        <asp:Button ID="Button1" Text="Postback" runat="server" />
        <telerik:RadFilter runat="server" OnFieldEditorCreating="RadFilter1_FieldEditorCreating" OnApplyExpressions="RadFilter1_ApplyExpressions">
            <FieldEditors>
                <mycustom:MyRadFilterDropDownEditor DataTextField="Text" DataValueField="Value" FieldName="USR_ID" DataType="System.Int32" DisplayName="User name" DDLType="Usernames" />
                <mycustom:MyRadFilterDropDownEditor DataTextField="Text" DataValueField="Value" FieldName="PNT_ID" DataType="System.Int32" DisplayName="Note" DDLType="PartyNotes" />
                <mycustom:MyRadFilterDropDownEditor DataTextField="Text" DataValueField="Value" FieldName="PGT_ID" DataType="System.Int32" DisplayName="Group" DDLType="PartyGroups" />
            </FieldEditors>
        </telerik:RadFilter>
        Expression:
        <asp:Label runat="server" ID="Log"/>
    </div>
    </form>
</body>
</html>

MyRuntimeEditor.aspx.vb
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
Imports CustomEditors
Imports MyCustomEditors
 
Partial Class MyRuntimeEditor
    Inherits System.Web.UI.Page
 
 
    Protected Sub RadFilter1_ApplyExpressions(ByVal sender As Object, ByVal e As RadFilterApplyExpressionsEventArgs)
        Dim provider As New RadFilterSqlQueryProvider()
        provider.ProcessGroup(e.ExpressionRoot)
 
        Log.Text = provider.Result
    End Sub
 
    Protected Sub RadFilter1_FieldEditorCreating(ByVal sender As Object, ByVal e As RadFilterFieldEditorCreatingEventArgs)
        e.Editor = New MyRadFilterDropDownEditor()
    End Sub
 
End Class

CustomEditor.vb
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports Telerik.Web.UI
Imports System.Web.UI
Imports System.Collections
 
Namespace CustomEditors
    Public Class RadFilterDropDownEditor
        Inherits RadFilterDataFieldEditor
 
 
        Public Property DataTextField() As String
            Get
                Return If(DirectCast(ViewState("DataTextField"), String), String.Empty)
            End Get
            Set(ByVal value As String)
                ViewState("DataTextField") = value
            End Set
        End Property
        Public Property DataValueField() As String
            Get
                Return If(DirectCast(ViewState("DataValueField"), String), String.Empty)
            End Get
            Set(ByVal value As String)
                ViewState("DataValueField") = Value
            End Set
        End Property
        Public Property DataSourceID() As String
            Get
                Return If(DirectCast(ViewState("DataSourceID"), String), String.Empty)
            End Get
            Set(ByVal value As String)
                ViewState("DataSourceID") = Value
            End Set
        End Property
 
        Private _combo As RadComboBox
 
        Protected Overrides Sub CopySettings(ByVal baseEditor As RadFilterDataFieldEditor)
            MyBase.CopySettings(baseEditor)
            Dim editor As RadFilterDropDownEditor = TryCast(baseEditor, RadFilterDropDownEditor)
            If editor IsNot Nothing Then
                DataSourceID = editor.DataSourceID
                DataTextField = editor.DataTextField
                DataValueField = editor.DataValueField
            End If
        End Sub
 
        Public Overrides Function ExtractValues() As System.Collections.ArrayList
            Dim list As New ArrayList()
            list.Add(_combo.SelectedValue)
            Return list
        End Function
 
        Public Overrides Sub InitializeEditor(container As System.Web.UI.Control)
            _combo = New RadComboBox()
            _combo.ID = "MyCombo"
            _combo.DataTextField = DataTextField
            _combo.DataValueField = DataValueField
            _combo.DataSourceID = DataSourceID
 
            container.Controls.Add(_combo)
        End Sub
 
        Public Overrides Sub SetEditorValues(values As System.Collections.ArrayList)
            If values IsNot Nothing AndAlso values.Count > 0 Then
                If values(0) Is Nothing Then
                    Return
                End If
 
                AddHandler _combo.DataBound, _
                    Sub(sender, args)
                        Dim item As RadComboBoxItem = _combo.FindItemByValue(values(0).ToString())
                        If item IsNot Nothing Then
                            item.Selected = True
                        End If
                    End Sub
            End If
 
        End Sub
    End Class
End Namespace

DataObject.vb
Imports Microsoft.VisualBasic
Imports System.Data
 
Public Class DataObject
    Public Function GetUsers() As DataTable
        Dim dt As DataTable = CreateDataTable()
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 1, "Joe One"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 2, "Joe Two"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 3, "Joe Three"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 4, "Joe Four"))
        Return dt
    End Function
 
    Public Function GetNoteTypes() As DataTable
        Dim dt As DataTable = CreateDataTable()
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 1, "Internal"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 2, "Email"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 3, "Phone"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 4, "Sales Call"))
        Return dt
    End Function
 
    Public Function GetPartyGroups() As DataTable
        Dim dt As DataTable = CreateDataTable()
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 1, "Internet Lead"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 2, "Website"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 3, "Cold calling"))
        dt.Rows.Add(CreateDataRow(dt.NewRow(), 4, "Phoned in"))
        Return dt
    End Function
 
    Private Function CreateDataRow(ByVal r As DataRow, ByVal Value As Integer, ByVal Text As String) As DataRow
        r("Value") = Value
        r("Text") = Text
        Return r
    End Function
 
    Private Function CreateDataTable() As DataTable
        Dim dt As New DataTable
        dt.Columns.Add("Value", GetType(Integer))
        dt.Columns.Add("Text", GetType(String))
        Return dt
    End Function
End Class


Thanks
Don Tompkins
Top achievements
Rank 1
 answered on 27 Apr 2011
4 answers
66 views
Hello,

I am trying to export a grid to PDF on shared hosting. From what I can tell PDF export needs full trust to write a temporary pdf to the server. I do not have full trust on the server.
Is there a way to export the PDF to MemoryStream and then write the MemoryStream's content using something like:
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Type", "application/pdf");
Response.BinaryWrite(....);
Response.Ende();

?
Brecht
Top achievements
Rank 1
 answered on 27 Apr 2011
1 answer
31 views
Hi ,

I am facing problem in showing the sum of values on top of stacked bar chart .

Can any one help me with this.

Thanks


Evgenia
Telerik team
 answered on 27 Apr 2011
1 answer
59 views
I have a grid in web page.  At that grid, I add an "edit all" button at command template.  When user clicks it, all rows at that grid will be in edit mode.  And another "update all" will update all user's change and update data into database.  That works fine.  Problem comes when I try to add spelling check function to it.

I add spelling check to "update all" and it works, and speeling check "update" button at a grid row and it works fine too.  But when user clicks "edit all" button, all rows in edit mode. "Hidden" controls  are needed for each row to hold "update" button client id, and radajaxmanager needs to add <ajaxsettings> dynamically too.  I want to check with you the way I try to code is right, and please provide me some sample code to accomplish it.

Thanks
Radoslav
Telerik team
 answered on 27 Apr 2011
1 answer
50 views
Hello,

I have a problem with radwindow.
Silverlight controls hides the radwindow control border (Please view the attached image).

Here is my code:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
            <Windows>
                <telerik:RadWindow id="RadWindow2" runat="server" Width="400px" Height="300px" style="z-index:100000;"
                    VisibleTitlebar="false" VisibleStatusbar="false" BackColor="#cccccc" title="Telerik RadWindow" VisibleOnPageLoad="false" >
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
  
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function UseMainRadWindow() {
                    var oWindow = radopen("http://zajal.rayanet.co.il/Common/Alerts/Silverlight/Default.aspx", "RadWindow2");
                    oWindow.set_visibleTitlebar(false);
                    oWindow.set_visibleStatusbar(false);
                }
  
                function onloadFunction() {
                    var slVersion = GetSilverlightVersion();
                        if (slVersion != -1)
                            UseMainRadWindow();
                }
            </script>
        </telerik:RadCodeBlock>


Please, I need you help,
It is apprecited to send me the modified code with an explaination.

Regards,
Bader
Cori
Top achievements
Rank 2
 answered on 27 Apr 2011
4 answers
179 views
Hello,

I am not able to close a radwindow. I tried using the following code but the javascript is not getting invoked. Can someone help me please? Is there something funky going on with Ajax?

    <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 CloseOnReload() {
            GetRadWindow().Close();
        }
    </script>

//CS Code
//injectscript is a label
InjectScript.Text = "<script type='text/javascript'>CloseOnReload()</" + "script>";


Cori
Top achievements
Rank 2
 answered on 27 Apr 2011
5 answers
805 views
Hi,

Can somebody help me set text box property on the client. The problem I'm having is that the text box is within the rad grid control.
I'm able to set the textbox text property with the following but not when the textbox is in telerik:GridTemplateColumn.

        var textbox =  $find("txtDescription");
  textbox .set_value(result);

but this doesn't work for the following.

  <telerik:GridTemplateColumn HeaderText="Description" DataField="Description"  UniqueName="Description">
                        <EditItemTemplate>
                             <telerik:RadTextBox ID="txtDescription" runat="server" Width="200px"> </telerik:RadTextBox>
                        </EditItemTemplate>
</telerik:GridTemplateColumn>

Thanks,
Ron.

Ron
Top achievements
Rank 1
 answered on 27 Apr 2011
3 answers
38 views

When using the RadFileExplorer in IE (and IE only…Firefox, Safari, Chrome all handle the following perfectly/quickly…only IE has the issue), if the directory has a lot of images in it (say, 50 or more, or perhaps the file sizes of the images are quite large), the launching of this tool will literally FREEZE the IE browser for 30-60 seconds (IE's windows-bar displays "(Not Responding)" if you try to click anywhere in the window). The RadEditor is a part of our online application where significant numbers of fairly novice users utilize it to build simple email content. So…the patience level of these authors is very low, and they often will simply attempt to close the browser, as they believe the system has crashed….when in fact, if they just waited 30-60 seconds the problem would go away. 

Rumen
Telerik team
 answered on 27 Apr 2011
6 answers
88 views
Hi,
After writing OnClientRated Function for a RadRating (A nested one) as below:

function OnClientRated(sender, args)
{
    ...
}

How Can I Convert sender to RadRating here, My goal is to access a property of my specific RadRating Control(I'm using RadRating in a DataList Control ). I know that I can do it in ItemDataBound event of DataList, But it's not good enough considering that I have to use the value here in JavaScript Function(I'm going to use it as a QueryString Value in order to redirect to a page shown in RadWindow).
Would you please help me out?
Niko
Telerik team
 answered on 27 Apr 2011
1 answer
94 views
In my grid there is column which contain either '1' or '0' for each of the rows. On grouping, all columns with value '0' is displayed first in the grid. Is there any way by which I can reorder the groups ? I want the group with value '1' to be displayed on the top.

THanks
Shinu
Top achievements
Rank 2
 answered on 27 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?