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

5 posts, 0 answers
  1. Jerald
    Jerald avatar
    32 posts
    Member since:
    Jan 2016

    Posted 08 Nov 2017 Link to this post

    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.

  2. Jerald
    Jerald avatar
    32 posts
    Member since:
    Jan 2016

    Posted 08 Nov 2017 in reply to Jerald Link to this post

    I forgot to mention that I'm using an older version ... 2017.2.711.
  3. Jerald
    Jerald avatar
    32 posts
    Member since:
    Jan 2016

    Posted 10 Nov 2017 Link to this post

    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. 
  4. Jerald
    Jerald avatar
    32 posts
    Member since:
    Jan 2016

    Posted 15 Nov 2017 Link to this post

    OK, let's forget about attempting to find a solution.  Has anybody else come across this same issue?
  5. Jerald
    Jerald avatar
    32 posts
    Member since:
    Jan 2016

    Posted 12 Dec 2017 Link to this post

    Well if anybody else has this issue, just build the RadGrid programmatically and it'll work. 
Back to Top