RarGrid sorting while javascript disabled

3 posts, 0 answers
  1. Ahmed Al-Asaad
    Ahmed Al-Asaad avatar
    4 posts
    Member since:
    Jun 2009

    Posted 16 May 2011 Link to this post


    I am currently evaluating the Telerik ASP.NET AJAX suite. I am currently trying to test the grid while javascript is disabled, as per the company's accessibility policy. It seems that sorting is not working while javascript is disabled even when I follow this post

    I still get the hyperlink column headers with the javascript:_doPostback href

    Here is what I am doing different from the link above.
    The grid is part of ascx user control
    The columns are not auto generated
    some columns are sortable
    We are binding the grid in the code behind using collections

    Your help is appreciated.

    Private Sub RadGrid1_ColumnCreated(sender As Object, e As GridColumnCreatedEventArgs)
        e.Column.HeaderButtonType = GridHeaderButtonType.PushButton
    End Sub

    <cc2:AccessibleRadGrid ID="RadGrid1" runat="server" AllowPaging="True" AlternatingItemStyle-CssClass="alt"
           CssClass="grid1" AutoGenerateColumns="False"
           AllowSorting="True" CellSpacing="0"
           GridLines="None" ShowGroupPanel="True" IsJavascriptEnabled="False"
           AllowFilteringByColumn="True" Skin="Outlook">
           <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True">
               <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="100px" />
               <Scrolling AllowScroll="True" ScrollHeight="100px" UseStaticHeaders="True"></Scrolling>
           <AlternatingItemStyle CssClass="alt" />
           <MasterTableView DataKeyNames="ID,RDIMSRefNbr">
               <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
               <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                   <HeaderStyle Width="20px"></HeaderStyle>
               <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                   <HeaderStyle Width="20px"></HeaderStyle>
                   <telerik:GridBoundColumn FilterControlAltText="Type Column" HeaderText="Type" UniqueName="TypeColumn"
                       DataField="CommType" HeaderStyle-CssClass="alignCenter">
                   <telerik:GridBoundColumn FilterControlAltText="RDIMS Column" HeaderText="RDIMS" UniqueName="RDIMSColumn"
                       DataField="RDIMSRefNbr" HeaderStyle-CssClass="alignCenter" ItemStyle-CssClass="alignCenter">
                   <telerik:GridBoundColumn FilterControlAltText="Title Column" HeaderText="Title" UniqueName="TitleColumn"
                       DataField="RDIMSTitle" HeaderStyle-CssClass="alignCenter" ItemStyle-CssClass="alignCenter">
                   <telerik:GridTemplateColumn FilterControlAltText="Details Column" HeaderText="Details"
                       UniqueName="DetailsColumn" AllowFiltering="False">
                       <ItemStyle CssClass="alignCenter"></ItemStyle>
                       <HeaderStyle Width="12%" CssClass="alignCenter"></HeaderStyle>
                           <asp:Button ID="btnDisplay" runat="server" CommandName="Display" CausesValidation="false">
                   <telerik:GridTemplateColumn FilterControlAltText="Document Column" HeaderText="Document"
                       UniqueName="DocumentColumn" AllowFiltering="False">
                       <ItemStyle CssClass="alignCenter"></ItemStyle>
                       <HeaderStyle Width="15%" CssClass="alignCenter"></HeaderStyle>
                           <asp:Button CssClass="FakeLinkButton" ID="btnView" runat="server" CommandName="View">
                   <telerik:GridTemplateColumn FilterControlAltText="Action Column" HeaderText="Action"
                       UniqueName="ActionColumn" AllowFiltering="False">
                       <ItemStyle CssClass="alignCenter"></ItemStyle>
                       <HeaderStyle Width="12%" CssClass="alignCenter"></HeaderStyle>
                           <asp:Button ID="btnDelete" runat="server" CommandName="Delete1" CausesValidation="false">
                   <EditColumn FilterControlAltText="Filter EditCommandColumn column">
           <PagerStyle Mode="NextPrev" />
           <FilterMenu EnableImageSprites="False">
           <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">

  2. Mira
    Mira avatar
    1124 posts

    Posted 19 May 2011 Link to this post

    Hello Almed,

    The ColumnCreated event is fired after the creation of auto-generated columns.
    In your case I recommend that you set  the HeaderButtonType property to PushButton declaratively:
    <telerik:GridBoundColumn HeaderButtonType="PushButton"...>

    I hope this helps.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Ahmed Al-Asaad
    Ahmed Al-Asaad avatar
    4 posts
    Member since:
    Jun 2009

    Posted 23 May 2011 Link to this post

    Hi Mira,

    Thanks for your reply. Our requirements is to show the push buttons ONLY if javascript is disabled. I was able to get it to work by handling the Init event in the control (overriding the OnInit works as well). We, however, have to go the drawing board to standarize the way to set the IsJavaScriptEnabled property on the control

    Public Class AccessibleRadGrid
        Inherits Telerik.Web.UI.RadGrid
        Public Sub New()
        End Sub
        Protected Overrides Sub RegisterScriptControl()
            If IsJavascriptEnabled Then
            End If
        End Sub
        Protected Overrides Sub RegisterScriptDescriptors()
            If IsJavascriptEnabled Then
            End If
        End Sub
        Protected Overrides Sub RegisterCssReferences()
            If IsJavascriptEnabled Then
            End If
        End Sub
        Private _IsJavascriptEnabled As Boolean
        Public Property IsJavascriptEnabled() As Boolean
                Return _IsJavascriptEnabled
            End Get
            Set(ByVal value As Boolean)
                _IsJavascriptEnabled = value
            End Set
        End Property
        Private Sub AccessibleRadGrid_Init(sender As Object, e As System.EventArgs) Handles Me.Init
            If Not IsJavascriptEnabled Then
                For Each item As GridColumn In Columns
                    item.HeaderButtonType = GridHeaderButtonType.PushButton
            End If
        End Sub
    End Class
Back to Top