RadGrid SelectedItems without ViewState

3 posts, 0 answers
  1. Mark Greenberg
    Mark Greenberg avatar
    2 posts
    Member since:
    Oct 2009

    Posted 14 Oct 2009 Link to this post

    Hello,

    I have a RadGrid with 500 records per page and am trying to use the GridClientSelectColumn in conjuntion with the SelectedItems property on the server side.  Given the big page size, I have to have ViewState turned off.  This in turn results in 0 for the value of the SelectedItems property.  Can you please point me to a sample that provides a work around?

    Thanks,
    Chris
  2. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 15 Oct 2009 Link to this post

    Hey Chris,

    I had the same issue and no one at Telerik responded.  So what I did was invoke the OnRowClick method in the radGrid definition (sorry about the formatting - this telerik online editor sucks)

     

    <ClientSettings

     

    <ClientEvents OnRowClick="onRowClick" />

     

     

     

     

     

     

    </ClientSettings>
    in the aspx <telerik:radGrid> node, and set the OnAjaxRequest property to

     

    <

     

     

     

    telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">

    Then, in the JavaScript function I found the grid (table) row that was selected:

    function
    onRowClick( sender, args ) {

     

            var table_id = sender.ClientID

     

     

     

           var array_ = new Array()

     

     

              array_ = table_id.split( /[_]/ );

     

            var table = array_[ 3 ];

     

     

     

     

            switch( table ) {

     

                    case "Groups" :

     

     

     

                            var masterTable = $find( "<%= rad_Groups.ClientID%>" ).get_masterTableView();

     

     

     

                            var datum = masterTable.getCellByColumnUniqueName( masterTable.get_dataItems()[ args.get_itemIndexHierarchical
                                    () ],
    "groups_group_name" ).innerHTML;

     

     

     

                            break;

     

     

     

                    //  etc.
    }

     

     

     v

    ar ajaxManager = $find( "<%= RadAjaxManager1.ClientID %>" );

     

     

     ajaxManager.ajaxRequest( datum );

    }

    AjaxManager then makes an asyncronous call to the server and sends the datum to

    Protected
    Sub RadAjaxManager1_AjaxRequest( sender As Object, e As AjaxRequestEventArgs ) _ 
            Handles RadAjaxManager1.AjaxRequest

     

            Dim temp_array() As String = Split( e.Argument, "|" )

     

     

     

            Try

     

     

     

     

                    Select Case temp_array.Length

     

     

     

                           Case Is = 1

     

     

                            Session(

    "groupName") = e.Argument

     

     

     

                   Exit Select

     

     

     

     

            Catch ex As Exception
                    RadAjaxManager1.Alert( "Doh!" )
            End Try

    Where you can manipulate the datum; in my case, I set a session variable so that I can then insert, delete, update on the server side (which I found necessary if you are using object data sources because the Telerik documentation is so lame and no one there seems to know how to use object data sources).

    Hope this helps,
    Mark

     

     

     

     

     

     

     

     

     

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 15 Oct 2009 Link to this post

    As a note about the editor comment: You are able to press the "Format Code block" icon between the broken link image and the spell check image. This way you can auto-format the code any way you like and it's contained within a nice scrollable area :D
Back to Top