SelectedIndexChanged in GridTableView

3 posts, 1 answers
  1. Anne
    Anne avatar
    2 posts
    Member since:
    Mar 2014

    Posted 21 Aug 2014 Link to this post

    I am working on a menu using a RadGrid. developing in C#

    I have a MasterTableView that contains the Main information, and one GridTableView in DetailTables. (Check menu attach file)
    Once I click the expanded icon on then master table, the grid table view is displayed.

    I am looking at selecting a record on the GridTableView (by clicking on the record) to open a form.

    However the OnSelectedIndexChanged is not firing.
    So I don't know if it should be set up diferently when in a GridTableView (as it is working if I put the event in the RadGrid at a higher level)
    Or if I should use another event.

    This is how I have set it up (Check html file attached for more details):
    - EnablePostBackOnRowClick="true" in the Client settings of the RadGrid.
    - OnSelectedIndexChanged="GV_SelectedIndexChanged" set up in the GridTableView, and the C# code added accordingly.

    Thank you for your help.

  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2014 in reply to Anne Link to this post

    Hi Anne,

    If you want the OnSelectedIndexChanged event of the RadGrid you can set it up in the RadGrid itself and it will fire for all tables. In order for this event to fire set EnablePostBackOnRowClick="true"  and in code behind you can identify which table caused the postback as follows:

    <telerik:RadGrid ID="rgrdSample" runat="server" OnSelectedIndexChanged="rgrdSample_SelectedIndexChanged">
        . . .
      <ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">

    protected void rgrdSample_SelectedIndexChanged(object sender, EventArgs e)
        foreach (GridDataItem selectedItem in rgrdSample.SelectedItems)
           //Identify the Detail Tables using Name
            if (selectedItem.OwnerTableView.Name == "You GridTableView Name")

  3. DevCraft R3 2016 release webinar banner
  4. Anne
    Anne avatar
    2 posts
    Member since:
    Mar 2014

    Posted 25 Aug 2014 in reply to Shinu Link to this post

    Thank you. It's working now. I think the SelectedIndexChanged event was not firing from the grid as I had one as well in the GridTable View.
    All working now, thanks again
Back to Top