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

SelectedIndexChanged Not Firing

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryan Hughes
Top achievements
Rank 1
Bryan Hughes asked on 11 Jan 2013, 09:41 PM
I am using the Web Mail Demo as an example source for new layout I need.  Everything works fine except the SelectedIndexChanged is not working when a new row is selected.  I have EnablePostBackOnRowClick=True in Grid cleint settings. and Event for SelectedIndexChanged but it never fires event and loads selected data in DetailsView.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
                GridLines="None" Height="100%" BorderWidth="0" AllowSorting="true"
                ShowGroupPanel="true" Skin="Windows7">
                <ClientSettings Scrolling-AllowScroll="True" Scrolling-UseStaticHeaders="True" Selecting-AllowRowSelect="True" EnablePostBackOnRowClick="True" EnableRowHoverStyle="True"
                ClientEvents-OnRowSelected="onGridRowSelected"></ClientSettings>
                <MasterTableView TableLayout="Fixed" GroupLoadMode="Client" DataKeyNames="MessageGUID" ClientDataKeyNames="MessageGUID" Width="100%" OnSelectedIndexChanged="RadGrid1_RowSelected">
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="GroupDate" HeaderText="Date" FormatString="{0}" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="Grouping" SortOrder="Ascending" HeaderText="Sort By Date" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn1">
                            <HeaderStyle Width="24px" />
                            <ItemStyle VerticalAlign="Middle"/>
                            <ItemTemplate>
                                <img src="~/images/icon-msg-read.gif" id="mailicon" runat="server" style="width: 16px; height: 16px" alt="MailIcon" align="middle" />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <Telerik:GridBoundColumn HeaderStyle-Width="130px" HeaderText="To" Visible="false" DataField="ToUserFullName" SortExpression="ToUserFullName" UniqueName="ToUserFullName" >
                        </Telerik:GridBoundColumn>
                        <Telerik:GridBoundColumn HeaderStyle-Width="130px" HeaderText="From" DataField="FromUserFullName" SortExpression="FromUserFullName" UniqueName="FromUserFullName" >
                        </Telerik:GridBoundColumn>
                        <Telerik:gridboundcolumn HeaderText="Subject" DataField="Subject" SortExpression="Subject" UniqueName="Subject" />
                        <Telerik:GridBoundColumn UniqueName="DateCreated" SortExpression="DateCreated" HeaderText="Received" DataField="DateCreated" HeaderStyle-Width="150px">
                        </Telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
Protected Sub RadGrid1_RowSelected(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
        Session("SelectedMessage") = RadGrid1.SelectedValue.ToString
        LoadMessage()
        Dim errors As String = ""
    End Sub
 

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 16 Jan 2013, 12:03 PM
Hello Bryan,

I was not able to reproduce the issue. I noticed that you attached the event on the MasterTableView. What I could suggest you is to hook it on the RadGrid itself. Check out the following code snippet:
<telerik:RadGrid ID="RadGrid1" runat="server" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">

Additionally I prepared a small sample based on your code and attached it to this thread.

Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Bryan Hughes
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or