This is a migrated thread and some comments may be shown as answers.

[Solved] Client Row Selection Problem

7 Answers 189 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gilberto Anino
Top achievements
Rank 1
Gilberto Anino asked on 05 Feb 2010, 06:48 PM
I am working with a Grid. I use the client side row selection but, when I try to get the selected item (server side) the "SelectedIndexes.count" is always 0 (zero) although I have a row selected. What can I do???

DGRID CODE
<telerik:RadGrid ID="CnsGrid"  runat="server" Style="position: static" AllowFilteringByColumn="True"  
        AllowPaging="True" AllowSorting="True" GridLines="None" PageSize="15" ShowGroupPanel="True" Skin="Simple" AllowCustomPaging="True"
            <GroupPanel Text="Arrastre un t&#237;tulo de columna aqu&#237; para agrupar por dicha columna"
            </GroupPanel> 
            <PagerStyle FirstPageToolTip="Primera p&#225;gina" LastPageToolTip="&#217;ltima P&#225;gina" 
                NextPagesToolTip="Pr&#243;ximas P&#225;ginas" NextPageToolTip="Pr&#243;xima P&#225;gina" 
                PrevPagesToolTip="P&#225;gina Anterior" PrevPageToolTip="P&#225;gina Anterior" PagerTextFormat="Cambiar p&#225;gina: {4} &amp;nbsp;P&#225;gina &lt;strong&gt;{0}&lt;/strong&gt; de &lt;strong&gt;{1}&lt;/strong&gt;, items &lt;strong&gt;{2}&lt;/strong&gt; a &lt;strong&gt;{3}&lt;/strong&gt; de &lt;strong&gt;{5}&lt;/strong&gt;." /> 
            <GroupingSettings CollapseTooltip="Contraer grupo" ExpandTooltip="Expandir grupo" 
                GroupContinuedFormatString="... grupo viene de la p&#225;gina anterior" GroupContinuesFormatString="Grupo continua en la siguiente p&#225;gina..." 
                ShowUnGroupButton="True" UnGroupButtonTooltip="Click aqui para desagrupar" UnGroupTooltip="Arrastre fuera para eliminar el grupo por dicha columna" /> 
             
            <SortingSettings SortedAscToolTip="Orden Asc" SortedDescToolTip="Orden Desc" SortToolTip="Clic aqu&#237; para ordenar" /> 
            <StatusBarSettings LoadingText="Cargando..." ReadyText="Listo" /> 
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> 
            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> 
            <FilterItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> 
            <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> 
             
            <ClientSettings EnableRowHoverStyle="True"
                <Selecting AllowRowSelect="True" /> 
            </ClientSettings> 
            <SelectedItemStyle BackColor="#FFC080" /> 
             
        </telerik:RadGrid> 


VB CODE
        Dim ArrRes() As String = Nothing 
        Dim index As Integer 
        Session("Cns_sn_cancel") = False 
 
        Try 
            For index = 2 To CnsGrid.Items(Me.CnsGrid.SelectedIndexes(0)).Cells.Count - 1 
                         'HERE I ALWAYS GET AN ERROR  
                         'BECAUSE THERE'S NO ROW SELECTED 
                ReDim Preserve ArrRes(index) 
                ArrRes(index - 2) = CnsGrid.Items(Me.CnsGrid.SelectedIndexes(0)).Cells(index).Text 
            Next 
 
            Session("ResConsulta") = ArrRes 
        Catch ex As Exception 
            Session("CNS_sn_error") = True 
            Session("Cns_error") = ex.Message.ToString 
        Finally 
 
            Dim strScript As String 
            strScript = "<script language=javascript> " 
            strScript += "window.close();" 
            strScript += "</script>" 
            ClientScript.RegisterStartupScript(Me.Page.GetType(), "CierraConsulta", strScript) 
        End Try 

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 05 Feb 2010, 09:55 PM
Hello Gilberto,

I recommend you try to set EnablePostBackOnRowClick="true": This way you will be able to access the selected item server-side.
<ClientSettings EnablePostBackOnRowClick="true">
    <Selecting AllowRowSelect="true" />
</ClientSettings>

Best regards,
Daniel
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Pierre
Top achievements
Rank 1
answered on 06 Feb 2010, 02:28 PM
Hi,

I have another problem using similar features. My ajax page make a postback and complete refreshing page after select like no ajaxified grid. I use same sample as demo site in last q2. PlanGrid is using one AjaxProxyManager in masterpage but this one not affecting another grid used.

<telerik:RadGrid ID="PlanGrid" EnableAJAX="True" EnableAJAXLoadingTemplate="True" runat="server" Skin="WebBlue"  GridLines="None" Width="100%" OnNeedDataSource="PlanGrid_NeedDataSource" 
                         OnItemCreated="PlanGrid_ItemCreated" OnUpdateCommand="PlanGrid_UpdateCommand"  AutoGenerateColumns="False" AllowMultiRowEdit="True" ShowStatusBar="true" AllowPaging="True">  
                             <MasterTableView DataKeyNames="Week" Width="100%" CommandItemDisplay="Top" EditMode="InPlace" PageSize="14">  
                                           <Columns> 

thanks.
0
Daniel
Telerik team
answered on 10 Feb 2010, 05:57 PM
Hello Pierre,

I'm not sure which version of RadControls you use - the tag name suggests that you use RadControls for ASP.NET AJAX but the EnableAJAX property is part of the RadControls for ASP.NET suite. Please post your markup in this thread and I will try to find out what is wrong.

Best regards,
Daniel
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Pierre
Top achievements
Rank 1
answered on 10 Feb 2010, 06:14 PM
Hi Daniel,

I use ASP.Net ajax controls Q2.2009. I have tested so many configurations and forget this oldest features. Always same problem with postback. I use this grid in one UC inside a master page. I have added scriptmanager and RadAjaxmanager inside and cast the manager in my UC. AFter select checkbox or next page the grid is postback no ajax. I use same configuartion that sample telerik as select server side. I have make other test using client side selecting but here have some big problems with the webservice that is cached in my cms not allowing and generating error 500. I very frustated.
Server side --> Grid generating many postabck after clickevents
ClientSide -->cms is bloquing the response with error 500 for webservice.

Thanks

 
0
Daniel
Telerik team
answered on 16 Feb 2010, 10:29 AM
Hello Pierre,

Thank you for the explanation, however it is hard to guess where the problem with postbacks comes from. Please post the (user control) markup along with the RadAjaxManager settings so I can examine them on my end. In the meantime I recommend you take a look at the following links that will help you take advantage of the RadAjaxManagerProxy:
New Best Practice: Ajaxifying UserControls
AJAX Manager Proxy

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Pierre
Top achievements
Rank 1
answered on 16 Feb 2010, 11:51 AM
Hi Daniel,

After many test ii seems that is one registrering Ajax settings problems but i m not fixed. I use the radAjaxManager inside one master page. The radgrid is in one UC. I have two others grids that use same master page with others settings register at load. I have fixed in one, but the others are touched. The problems seams be during the registering of settings used in RadAjaxManager that not fire the grid. The working grid is registering the settings after each Postback at Load. RadAjaxManager need to bee register after every load event (register only !IsPostback no working). Using same methods with others grid no working very well. Only the first register work as espected many be some memory cache for the master page. I have tried using one clearSettings before register the others but is not better.
I resume, One masterpage and 3 UC with grids. The RadAjaxmanager is in masterpage with no settings. Every UC registering her AjaxSettings during Load event(every load). RadAjaxmanager is not firing for second and 3th grid now. Could you make one test using this configuration(1.master, 3 UC with Grids, registering ajax in codebehind).

Regard, Romi.
 
0
Daniel
Telerik team
answered on 23 Feb 2010, 09:56 AM
Hello Pierre,

I created a sample project based on the provided description. Please test it on your end and let me know whether it works as expected.

Best regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Gilberto Anino
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Pierre
Top achievements
Rank 1
Share this question
or