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

RadGrid populated by the selected row of another isn't selectable

4 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jerald
Top achievements
Rank 1
Jerald asked on 09 Nov 2017, 12:44 AM

I'm using the following SqlDataSource to populate a RadGrid and it works as expected:

SqlDataSource sdsRgVens = new SqlDataSource();
            sdsRgVens.ID = "sdsRgVens";
            this.Page.Controls.Add(sdsRgVens);
            sdsRgVens.DataSourceMode = SqlDataSourceMode.DataSet;
            sdsRgVens.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["drappConnectionString"].ConnectionString;
            sdsRgVens.SelectCommand = "SELECT venIdPk, venNm, venCity, venStateAcro, venZipCode FROM vendors";
 
            rgVens.DataSource = sdsRgVens;
            rgVens.DataBind();


Here's the code for the RadGrid:

<telerik:RadGrid ID="rgVens" runat="server" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" ShowGroupPanel="True" OnPreRender="rgVens_PreRender" OnItemCommand="rgVens_ItemCommand" >
                <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True"></ClientSettings>
                <MasterTableView DataKeyNames="venIdPk" PagerStyle-AlwaysVisible="true">
                    <Columns>
                        <telerik:GridButtonColumn CommandName="Select" Text="Select" ButtonType="LinkButton"></telerik:GridButtonColumn>
                        <telerik:GridBoundColumn DataField="venIdPk" ReadOnly="True" HeaderText="venIdPk" SortExpression="venIdPk" UniqueName="venIdPk" DataType="System.Int32" FilterControlAltText="Filter venIdPk column"></telerik:GridBoundColumn>                                               
                        <telerik:GridBoundColumn DataField="venNm" HeaderText="Name" SortExpression="venNm" UniqueName="venNm" FilterControlAltText="Filter venNm column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="venCity" HeaderText="City" SortExpression="venCity" UniqueName="venCity" FilterControlAltText="Filter venCity column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true"></telerik:GridBoundColumn>                       
                        <telerik:GridBoundColumn DataField="venStateAcro" HeaderText="State" SortExpression="stateProvAcro" UniqueName="stateProvAcro" FilterControlAltText="Filter stateProvAcro column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="venZipCode" HeaderText="Zip Code" SortExpression="venZipCode" UniqueName="venZipCode" FilterControlAltText="Filter venZipCode column" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true"></telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

When a row is selected in the first RadGrid another RadGrid is populated as expected. 

Here's the SqlDataSource for the second RadGrid

<asp:SqlDataSource ID="sdsRgVenDocs" runat="server"
                ConnectionString='<%$ ConnectionStrings:drappConnectionString %>'
                SelectCommand="SELECT [docIdPk], [docTitle], [venIdFk] FROM [docs] WHERE ([venIdFk] = @venIdFk)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="rgVens" PropertyName="SelectedValue" Name="venIdFk" Type="Int32"></asp:ControlParameter>
                </SelectParameters>
            </asp:SqlDataSource>

Here's the code for the second RadGrid:

<telerik:RadGrid ID="rgVenDocs" runat="server" DataSourceID="sdsRgVenDocs" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" ShowGroupPanel="True" Skin="Default">
                <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True" ReorderColumnsOnClient="True"></ClientSettings>
                <MasterTableView DataKeyNames="docIdPk" DataSourceID="sdsRgVenDocs">
                    <Columns>
                        <telerik:GridButtonColumn CommandName="Select" Text="Select" ButtonType="LinkButton"></telerik:GridButtonColumn>
                        <telerik:GridBoundColumn DataField="docIdPk" ReadOnly="True" HeaderText="docIdPk" SortExpression="docIdPk" UniqueName="docIdPk" DataType="System.Int32" FilterControlAltText="Filter docIdPk column"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="docTitle" HeaderText="docTitle" SortExpression="docTitle" UniqueName="docTitle" FilterControlAltText="Filter docTitle column"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="venIdFk" HeaderText="venIdFk" SortExpression="venIdFk" UniqueName="venIdFk" DataType="System.Int32" FilterControlAltText="Filter venIdFk column"></telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>

At this point I should be able to select a row in the second RadGrid, but when I click on the "Select" link button the row is not selected.  

How can I get the row in the second RadGrid to be selectable like the first RadGrid?  I can get this to work as expected if I just use the asp:GridView controls.

4 Answers, 1 is accepted

Sort by
0
Jerald
Top achievements
Rank 1
answered on 09 Nov 2017, 12:49 AM
I forgot to mention that I'm using an older version ... 2017.2.711.
0
Jerald
Top achievements
Rank 1
answered on 10 Nov 2017, 04:22 PM
I also forgot to mention that if I use a SqlDataSoure on the aspx page for the first RadGrid then everything works just fine.  Unfortunately that is not a valid option for me at this time. 
0
Jerald
Top achievements
Rank 1
answered on 15 Nov 2017, 04:37 PM
OK, let's forget about attempting to find a solution.  Has anybody else come across this same issue?
0
Jerald
Top achievements
Rank 1
answered on 12 Dec 2017, 03:25 PM
Well if anybody else has this issue, just build the RadGrid programmatically and it'll work. 
Tags
Grid
Asked by
Jerald
Top achievements
Rank 1
Answers by
Jerald
Top achievements
Rank 1
Share this question
or