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

How to get SelectedIndex on the Client?

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Delicious!
Top achievements
Rank 1
Delicious! asked on 27 May 2009, 12:20 AM
On the OnRowDblClick client event, I'd like the grid to postback and send the SelectedIndex as an argument.  I stumbled upon this article:  http://www.telerik.com/help/aspnet/grid/grdpostbackfromgridwithajaxenabled.html, and I'm curious to know how the "this" keyword is referencing the grid control.  In my code, "this" refers to the calling function.

Here a snippet of my code:

<rad:RadGrid ID="claimLvlGrid" runat="server" DataSourceID="claimLvlODS"  
            AutoGenerateColumns="false" SelectedItemStyle-CssClass="selectedRow"  
            HeaderStyle-HorizontalAlign="Center" Skin="Outlook">                         
            <ClientSettings Selecting-AllowRowSelect="true" Scrolling-AllowScroll="true"  
                Scrolling-ScrollHeight="75px" Scrolling-UseStaticHeaders="true"  
                ClientEvents-OnRowDblClick="test" />             

    <rad:RadScriptBlock runat="server"
        <script type="text/javascript">             
            function test() 
            {                 
                __doPostBack("<%= claimLvlGrid.UniqueID %>", <index>);                 
            }         
        </script> 
    </rad:RadScriptBlock> 


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 May 2009, 03:58 AM
Hi Ohrange,

The OnRowDblClick() event handler accept rowindex as argument. Try modifying the function as shown below.

JavaScript:
 
<script type="text/javascript"
function test(rowIndex) 
    alert("DblClick on row with index: " + rowIndex); 
    // Your code 
</script> 

Thanks,
Shinu.
Tags
Grid
Asked by
Delicious!
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or