Bind second table on value of first table

2 posts, 0 answers
  1. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 24 Jul 2008 Link to this post

    I have two radgrids.
    Grid one is based on Querystring field to select appropiate record
    Grid  two needs to based on value of a column in grid one.

    My datasource for grid two looks like this:
    1 <asp:SqlDataSource ID="dsStructure" runat="server"   
    2             ConnectionString="<%$ ConnectionStrings:csProperty %>"   
    3             SelectCommand="SELECT [ROLL_NO], [CHAR_OF_CONST], [QUALITY], [SHAPE], [YEAR_BUILT], [YEAR_BUILT_CODE], [CONDITION], [FULL_STOREYS], [PART_STOREYS], [HEIGHT_EFF_DATE_S], [SPLIT], [GROSS_AREA], [TOTAL_BASEMENT], [FINISH_BASEMENT], [FINISH_BASEMENT_TY], [FULL_BATHS], [HALF_BATHS], [NO_OF_BEDROOMS], [NO_OF_FIREPLACES], [HEATING_TYPE], [AIR_CONDITIONING], [GARAGE_TYPE], [GARAGE_SPACES], [STRUCT_CODE] FROM [TX_STRUCT] WHERE ([ROLL_NO] = @ROLL_NO) ORDER BY [CHAR_OF_CONST] DESC">  
    4              <SelectParameters> 
    5             <asp:ControlParameter ControlID="RadGrid1" Name="ROLL_NO"   
    6                 PropertyName="SelectedValue" Type="string" /> 
    7         </SelectParameters> 
    8         </asp:SqlDataSource> 

    However, my second grid does not bind, and therefore is not displayed.
    I have set DataKeyNames in Grid One, but still no dice.

    Please advise,
    Thanks
    Brett
  2. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 24 Jul 2008 Link to this post

    Got it to work with this code:

    Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender

    'change selection and add a response script to rebind the second grid

    RadGrid1.Items(0).Selected =

    True

    RadGrid2.MasterTableView.Rebind()

    End Sub

    Thanks
    Brett

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top