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

onRowDblClick show DetailsViews

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thabiso
Top achievements
Rank 1
Thabiso asked on 14 Feb 2011, 10:00 AM
Hi,

I have a radgrid in a pane as well as a deatils view in another pane on the same page. This is what i have been battling with On Row Double click, the  Rad Grid selected row data show display in Details View but at this point i just get data from the first row regardless i click the second row, the first row data always appears. My radgrid  uses entityframework and is bound programatically, while may detailsView data source is also entity data source but is not bound programatically.

Thanks in advance

Thabiso.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Feb 2011, 12:39 PM
Hello Thabiso,

Please take a look at the following code snippet which I tried for almost similar scenario. Hope it will help. I have achieved this by invoking the ajaxRequest from 'OnRowDblClick' client event and saving the key value in AjaxManager_AjaxRequest server event. Then poplate second RadGrid based on this value.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid1" AutoGenerateColumns="False" runat="server" >
    <MasterTableView ClientDataKeyNames="EmployeeID">
        <Columns>
            <telerik:GridBoundColumn DataField="EmployeeID" HeaderText="EmployeeID" UniqueName="EmployeeID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" UniqueName="FirstName">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings Selecting-AllowRowSelect="true">
        <ClientEvents OnRowDblClick="OnRowDblClick" />
    </ClientSettings>
</telerik:RadGrid>
<br />
<telerik:RadGrid ID="RadGrid2"  runat="server">
    <MasterTableView>
       
    </MasterTableView>
</telerik:RadGrid>

Java Script:
<script type="text/javascript">
    function OnRowDblClick(sender, args) {
        var key = args.getDataKeyValue("EmployeeID");
        $find("<%=RadAjaxManager1.ClientID%>").ajaxRequest(key);
    }
</script>

C#:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
   {
       string keyValue = e.Argument;//getting key value
       //populate the second Radgrid based on this value
   }

-Shinu.
Tags
Grid
Asked by
Thabiso
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or