Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
140 views
So here is the situation:

I have a RadGrid with 4 columns and am allowing filtering. I'm using the <FilterTemplate> for all four columns and am binding using the NeedDataSource event.

Everything is working great except that for one of the fields I want to actually requery the database rather than just filter. It is a date field and I would rather limit the results from the database on this filter rather than just filter the existing data.

Sooo...here is what I tried:

    Public Sub RadComboboxEmployeeDateSubmittedFilter_SelectedIndexChanged(ByVal sender As ObjectByVal e As RadComboBoxSelectedIndexChangedEventArgs)  
 
        _startDate = String.Format(CultureInfo.CurrentCulture, "1/1/{0} 12:00:00 AM", e.Value)  
        _endDate  = String.Format(CultureInfo.CurrentCulture, "12/31/{0} 11:59:59 PM", e.Value)  
 
        Session.Item("TransactionLogYearFilter") = e.Value   
 
        RadGridEmployeeTransactions.Rebind()  
 
    End Sub 

RadComboboxEmployeeDateSubmittedFilter is the combobox that is inside the DateSubmitted column <FilterTemplate>, so the code above fires when the user selects an item from the combobox.

Here is my NeedDataSource handler:

    Private Sub RadGridEmployeeTransactions_NeedDataSource(ByVal source As ObjectByVal e As GridNeedDataSourceEventArgs) Handles RadGridEmployeeTransactions.NeedDataSource  
 
        Dim lTransactions As DataSet = Nothing 
 
        If UserType <> EnumHelper.UserType.Employee Then 
            Return 
        End If 
 
        Try 
 
            lTransactions = MiBenefitsHelper.GetEmployeeTransactions(GroupNumber, _  
                                                                     FamilyNumber, _  
                                                                     _startDate, _  
                                                                     _endDate)  
 
            RadGridEmployeeTransactions.DataSource = lTransactions  
 
        Catch ex As WcfException  
 
            PanelEmployeeTransactionLog.Visible = False 
            PanelUpdateStatus.Visible = True 
            LabelUpdateStatus.Text = "There was an error returning your transactions and they cannot be displayed at this time. EBMS has been notified of the problem and will have it resolved as soon as possible." 
            LabelUpdateStatus.ForeColor = Color.Red  
            ExceptionPolicy.HandleException(ex, "Global Policy")  
 
        End Try 
 
    End Sub 

As you can see it is referencing the _startDate and _endDate fields which get populated when the user makes a selection from the dropdown.

The problem is that RadGridEmployeeTransactions.Rebind() does not cause the RadGridEmployeeTransactions_NeedDataSource event to fire, which means the database is not re-queried and the results are not filtered.

How do I go about forcing the RadGridEmployeeTransactions_NeedDataSource event to fire so that it queries the database with the correct _startDate and _endDate values??

Thanks!

Subhashini
Top achievements
Rank 1
 answered on 26 Mar 2015
4 answers
209 views
I have been tasked to use the PanelBar with Radio Buttons.   

The mock up below pretty much explains my needs.    Attendee logs in.  Then they see Thursday, Friday, Saturday, and Sunday as Top Panel bar items.  When they click on Thursday, the time slot followed by courses represented with Radio buttons is displayed for user to select a course taken for that time slot.

I have this all working with a combo box that the user selects which day they want and then the list shows.   However they have not changed there mind and want to use the PanelBar.

Any how to and code examples will be welcome, I didn't find anything to help with this yet.

Ivan Danchev
Telerik team
 answered on 26 Mar 2015
1 answer
70 views
I have attempted to recreate this demo on my local PC with the northwind DB:

http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/programmatic/defaultcs.aspx

Unfortunately, the clientside call in the client pageload event:

PageMethods.GetData(0, tableView.get_pageSize(),

does not initiate the following serverside code:

public static List<Employee> GetData(int startIndex, int maximumRows,

string sortExpressions, List<GridFilterExpression> filterExpressions)

this function fails here:

function RadGrid1_RowDataBound(sender, args) {

var radTextBox1 = args.get_item().findControl("LastName"); 

radTextBox1.set_value(args.get_dataItem()["LastName"]); fails here

}

Can someone please explain why the client side call does not work or provide me with a better example of clientside data binding.

Thanks in advance.

Mark

Pavlina
Telerik team
 answered on 26 Mar 2015
1 answer
42 views
Hi Team,

We are using Telerik version 2014.1.225.40 version in our application but some of the controls like RadMonthYearPicker not working in IE 9.Kindly suggest what would be the solution for this issue.

thanks,
Sarath
Pavlina
Telerik team
 answered on 26 Mar 2015
7 answers
142 views
I can only get the AccessKey funcionality of the RadTreeView to work in IE8. It is not working in Firefox 3.5, or Safari 4.0.

I copied and pasted the example provided under the control demo, and added accesskey="W".

When I press Alt+W in Firefox or Safari, nothing happens. The treeview is not focused, and I cannot use the arrow keys for navigation.
Dimitar
Telerik team
 answered on 26 Mar 2015
3 answers
563 views
I'm trying to define a CSS style to use in Combobox label which has WebBlue skin. I read about style definition in the forum and I added to my CSS file this code:

.RadComboBox_WebBlue .MyLabelStyle.riLabel
        {
    font-family: Verdana,Helvetica,Arial;
    font-size: 10pt;
    color: Navy;
        }

I assigned MyLabelStyle to the LabelCssClass property but nothing happens, the label style of the combobox doesn't change

Any suggestion?
Magdalena
Telerik team
 answered on 26 Mar 2015
6 answers
227 views
Hi - I would like to remove the time column from the agenda view, how can this be done?

Thanks
Magdalena
Telerik team
 answered on 26 Mar 2015
1 answer
106 views
Hi,

I need to react when a RadSlidingPane is expanded or collapsed.
To this end, I have the following declaration:

<telerik:RadSlidingZone ID="rszRight" runat="server" Width="22px" SlideDirection="Left">
<
telerik:RadSlidingPane ID="rspDetails" Title="Task Details" runat="server" Width="170px" OnClientCollapsed="rspDetails_Collapsed" OnClientExpanded="rspDetails_Expanded" >
...

Simply hovering over the pane's tab causes the OnClientExpanded event to fire (see green arrows in attachment).  This is as expected.
The problem is that the OnClientCollapsed event is firing when I click on the pin (dock) icon - not what I expected (see red arrow).
See the attached screenshot and note the console log at the bottom.

Am I doing something wrong?

Thanks in advance for any suggestions.

Jim

Vessy
Telerik team
 answered on 26 Mar 2015
2 answers
374 views
HI, i'm experiencing some difficulties on export content from radeditor (with images) to docx format, using radeditor.exportToDocX() method.

the problem is:
An exception of type 'Telerik.Web.UI.Editor.Export.RadEditorExportException' occurred in Telerik.Web.UI.dll but was not handled in user code
 
Additional information: The Document Processing Library fails to convert the RadEditor's content to RadFlowDocument

Here is the aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Editor2.aspx.vb" Inherits="Assistente_Legal.Editor2" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title>Editor de Texto</title>
    <telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            function saveAsPrompt(arg) {
                //debugger;
                var txt = $get('<%= txtFileName.ClientID%>');
                txt.value = arg;
                var btn = $get('<%= btnSaveAsCallBack.ClientID%>');
                btn.click();
            }
 
            function closeWin() {
                //GetRadWindow().BrowserWindow.location.href = 'Default2.aspx';
                GetRadWindow().close();
            }
            function GetRadWindow() {
                var oWindow = null; if (window.radWindow)
                    oWindow = window.radWindow; else if (window.frameElement.radWindow)
                        oWindow = window.frameElement.radWindow; return oWindow;
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="SM" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadSkinManager ID="SKM" runat="server" ShowChooser="false" Skin="Windows7" />
        <telerik:RadWindowManager ID="WM" runat="server"></telerik:RadWindowManager>
        <telerik:RadFormDecorator ID="FD" runat="server" DecoratedControls="All"></telerik:RadFormDecorator>
        <telerik:RadAjaxLoadingPanel ID="LP" runat="server"></telerik:RadAjaxLoadingPanel>
        <div id="Conteudo" runat="server">
            <telerik:RadAjaxPanel runat="server" LoadingPanelID="LP">
                <telerik:RadToolBar ID="TB" runat="server" EnableRoundedCorners="true" EnableShadows="true">
                    <Items>
                        <telerik:RadToolBarButton ImageUrl="~/Images/save32.png" Value="save"
                            Text="Salvar" ToolTip="Salvar">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton ImageUrl="~/Images/saveas32.png" Value="saveas"
                            Text="Salvar Como" ToolTip="Salvar Como">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton ImageUrl="~/Images/pdf32.png" Value="pdf"
                            Text="Exportar para PDF" ToolTip="Exportar para PDF">
                        </telerik:RadToolBarButton>
                        <telerik:RadToolBarButton ImageUrl="~/Images/exit32.png" Value="exit"
                            Text="Sair sem salvar" ToolTip="Sair sem salvar">
                        </telerik:RadToolBarButton>
                    </Items>
                </telerik:RadToolBar>
                <asp:Label runat="server" ID="lblReadOnly" Visible ="false" Text="Visualizando Documento Público, alteração não permitida." ToolTip="Para alterar o conteúdo deste documento, você deve copiá-lo para Meus Documentos primeiro!" />
                <telerik:RadEditor ID="EDT" runat="server" Width="100%" ToolbarMode="RibbonBar" ToolsFile="/Styles/editor_toolbars.xml"
                    Style="min-height: 90%;" EditModes="Design" AutoResizeHeight="true" EnableResize="true">
                    <CssFiles>
                        <telerik:EditorCssFile Value="~/Styles/Editor.css" />
                    </CssFiles>
                    <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings>
                </telerik:RadEditor>
            </telerik:RadAjaxPanel>
        </div>
 
        <asp:HiddenField ID="txtFileName" runat="server" />
        <asp:Button ID="btnSaveAsCallBack" runat="server" Text="Button" style="display: none;" />
    </form>
</body>
</html>

Here is the code-behind:
Imports Telerik.Windows.Documents.Flow.Model
Imports Telerik.Windows.Documents.Flow.Model.Styles
Imports Telerik.Windows.Documents.Flow.FormatProviders.Docx
Imports System.IO
Imports Telerik.Web.UI
Imports System.Threading
 
Public Class Editor2
    Inherits System.Web.UI.Page
    Private S As Sessao
 
    Private ReadOnly Property EhNovoDocumento As Boolean
        Get
            Return IsNothing(Request("arq"))
        End Get
    End Property
 
    Private _NomeDoArquivo As String = ""
    Public Property NomeDoArquivo() As String
        Get
            If _NomeDoArquivo.Length = 0 And Not EhNovoDocumento Then _NomeDoArquivo = Request.QueryString("arq")
            Return _NomeDoArquivo
        End Get
        Set(ByVal value As String)
            _NomeDoArquivo = value
        End Set
    End Property
 
    ''' <summary>
    ''' Retorna o diretório indicado pela querystring("dir"), caso não possua, retorna o diretório Meus Documentos do usuário conectado.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private ReadOnly Property Diretorio As String
        Get
            If Not IsNothing(Request("dir")) Then
                Dim dir As String = Request("dir")
                If Mid(dir, 1, dir.Length) <> "/" Then dir &= "/"
                Return dir
            Else
                Return "/Documentos/Usuario/" & S.Usuario.UID & "/Meus Documentos/"
            End If
        End Get
    End Property
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Sessao.IsValid Then S = Sessao.Load Else S = New Sessao() : Sessao.Save(S)
 
        If Not IsPostBack Then
            EDT.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertCharactersToEntities)
            ' EDT.EnableFilter(Telerik.Web.UI.EditorFilters.MakeUrlsAbsolute)
            If Not EhNovoDocumento Then
                Helpers.CarregarDocumento(EDT, Server.MapPath(NomeDoArquivo), S)
                If NomeDoArquivo.Contains("Documentos/Publico") Then desabilitaEdicao()
 
                End If
        End If
        setaDiretoriosEditor()
    End Sub
 
    Private Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
        If S.Alert.HaveMessage Then
            If S.Alert.IsPrompt Then
                WM.RadPrompt(Helpers.EncodeJsString(S.Alert.Message), S.Alert.CallBackFn, 300, 100, Nothing, Helpers.EncodeJsString(S.Alert.Title), "")
            Else
                WM.RadAlert(Helpers.EncodeJsString(S.Alert.Message), 250, 150, Helpers.EncodeJsString(S.Alert.Title), "")
            End If
            S.Alert.Dismiss()
        End If
    End Sub
 
    Private Sub desabilitaEdicao()
        For Each B As RadToolBarButton In TB.Items
            If B.Value <> "exit" Then B.Enabled = False
        Next
        lblReadOnly.visible = True
    End Sub
 
    Private Sub setaDiretoriosEditor()
        Dim MeusDocumentosVirtual As String = "~/Documentos/Usuario/" & S.Usuario.UID & "/Meus Documentos/"
        Dim EsteProcessoVirtual As String = ""
 
        If Not IsNothing(Session("Processo")) Then
            Using P As Processo = Session("Processo")
                EsteProcessoVirtual = "~/Documentos/Usuario/" & S.Usuario.UID & "/" & P.ID
            End Using
        End If
        EDT.ImageManager.ViewPaths = {MeusDocumentosVirtual, EsteProcessoVirtual}
        EDT.ImageManager.DeletePaths = {MeusDocumentosVirtual, EsteProcessoVirtual}
        EDT.ImageManager.UploadPaths = {MeusDocumentosVirtual, EsteProcessoVirtual}
        EDT.ImageManager.MaxUploadFileSize = 1048576
        EDT.ImageManager.EnableAsyncUpload = True
        EDT.ImageManager.AllowFileExtensionRename = False
 
    End Sub
    Private Sub TB_ButtonClick(sender As Object, e As RadToolBarEventArgs) Handles TB.ButtonClick
        Select Case e.Item.Value
            Case "save"
                Save()
            Case "saveas"
                SaveAs()
            Case "pdf"
                SaveAsPDF()
            Case "exit"
                ExitWithoutSave()
        End Select
    End Sub
 
    Private Sub Save()
        If Not EhNovoDocumento Then
            DoSave(NomeDoArquivo)
        Else
            S.Alert.Show("Escolha Salvar Como...")
        End If
    End Sub
 
    Private Sub SaveAs()
        S.Alert.CallBackFn = "saveAsPrompt"
        S.Alert.Show("Digite o nome do arquivo.<br>A extensão .docx será adicionada automaticamente.<br>Os seguintes caracteres são permitidos: Letras, Números, Hífen, Espaço e Underline.", "Nome do Arquivo", True)
    End Sub
    Private Sub SaveAsCallBack(ByVal sender As Object, ByVal e As EventArgs) Handles btnSaveAsCallBack.Click
        Dim tempName As String = txtFileName.Value
        If tempName.Length = 0 Or Helpers.RegexMatch(tempName, Helpers.ExpressoesRegulares.LetrasNumerosAcentosEspacoUnderlineHifen) Then
            S.Alert.Show("Nome do Arquivo Inválido!")
        Else
            tempName = Helpers.RemoveExtensao(tempName)
            NomeDoArquivo = Diretorio & tempName & ".docx"
            DoSave(NomeDoArquivo)
        End If
    End Sub
 
    Private Sub SaveAsPDF()
        If NomeDoArquivo.Length = 0 Then
            NomeDoArquivo = Diretorio & "Novo Documento de Texto.PDF"
        Else
            NomeDoArquivo = Helpers.TrocaExtensao(NomeDoArquivo, "PDF")
        End If
        Try
            If File.Exists(NomeDoArquivo) Then File.Delete(NomeDoArquivo)
            Helpers.CriarPDF(EDT.Content, Server.MapPath(NomeDoArquivo), S)
        Catch ex As Exception
            Dim temp As String = LOG.Excecao(ex)
            S.Alert.Show("Falha Ao Tentar exportar para PDF. O Administrador foi notificado sobre este problema.")
            MailUtil.Send("contato@assistentelegal.com.br", "Exceção Detectada", "Falha Ao Tentar Exportar PDF.<br>" & temp)
        Finally
            Dim msg As String
            If EhNovoDocumento Then
                msg = "Documento Salvo em PDF com sucesso em: " & NomeDoArquivo & vbCrLf & "Atenção, o arquivo PDF é somente leitura, se você quiser editar este conteúdo no futuro, escolha 'Salvar Como' e digite o nome do arquivo."
            Else
                msg = "Documento Salvo em PDF com sucesso!"
            End If
            S.Alert.Show(msg)
        End Try
    End Sub
 
    Private Sub ExitWithoutSave()
        Dim script As String = "function f(){closeWin(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, True)
    End Sub
 
    Private Sub DoSave(ByVal ARQ As String)
        'Dim provider As New DocxFormatProvider()
        'Dim document As RadFlowDocument = provider.Import(Input)
 
        If Helpers.EhWord(ARQ) Then EDT.ExportToDocx()
        If Helpers.EhRTF(ARQ) Then EDT.ExportToRtf()
        If Helpers.EhMarkdown(ARQ) Then EDT.ExportToMarkdown()
        If Helpers.EhTexto(ARQ) Then
            Try
                Using externalFile As New StreamWriter(Server.MapPath(ARQ), False)
                    externalFile.Write(EDT.Content)
                End Using
                S.Alert.Show("Documento salvo com sucesso!")
                Response.Redirect("/Editor2.aspx?arq=" & NomeDoArquivo)
            Catch tex As ThreadAbortException
                'ignore this exception
            Catch ex As Exception
                Dim temp As String = LOG.Excecao(ex)
                S.Alert.Show("Falha Ao Tentar Salvar o Arquivo. O Administrador foi notificado sobre este problema.")
                MailUtil.Send("contato@assistentelegal.com.br", "Exceção Detectada", "Falha Ao Tentar Salvar o Arquivo.<br>" & temp)
            End Try
        End If
    End Sub
 
    Private Sub EDT_ExportContent(sender As Object, e As Telerik.Web.UI.EditorExportingArgs) Handles EDT.ExportContent
        'neste momento, a propriedade NomeDoArquivo deverá estar configurada corretamente!!
        Dim ARQ As String = Server.MapPath(NomeDoArquivo)
        Try
            If File.Exists(ARQ) Then File.Delete(ARQ)
            Using externalFile As Stream = File.Create(ARQ)
                Dim b() As Byte = System.Text.Encoding.Default.GetBytes(e.ExportOutput)
                externalFile.Write(b, 0, b.Length)
                e.Cancel = True
            End Using
            S.Alert.Show("Documento salvo com sucesso!")
            Response.Redirect("/Editor2.aspx?arq=" & NomeDoArquivo)
        Catch tex As ThreadAbortException
            'ignore this exception
        Catch ex As Exception
            Dim temp As String = LOG.Excecao(ex)
            S.Alert.Show("Falha Ao Tentar Salvar o Arquivo. O Administrador foi notificado sobre este problema.")
            MailUtil.Send("contato@assistentelegal.com.br", "Exceção Detectada", "Falha Ao Tentar Salvar o Arquivo.<br>" & temp)
        End Try
    End Sub
End Class

The image i'm using is attached.

Thanks for the help.
Luiz
Top achievements
Rank 1
 answered on 26 Mar 2015
1 answer
94 views
Hello Telerik Team,

We would like to inquire regarding the RadProgressArea we used this to create a custom progress bar for our web application. The Progress bar functionality of the application is working as expected, or the progress bar is visible in the web application when deployed in Windows Server 2008 (has IIS 7 installed) but not in Windows Server 2003 (has IIS 6 installed).  May we ask if there are known limitations for RadProgressArea specifically for OS version or IIS?

Thanks! :)
Dimitar
Telerik team
 answered on 26 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?