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

Bind second table on value of first table

1 Answer 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 2
Brett asked on 24 Jul 2008, 06:41 PM
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:
<asp:SqlDataSource ID="dsStructure" runat="server"   
            ConnectionString="<%$ ConnectionStrings:csProperty %>"   
            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">  
             <SelectParameters> 
            <asp:ControlParameter ControlID="RadGrid1" Name="ROLL_NO"   
                PropertyName="SelectedValue" Type="string" /> 
        </SelectParameters> 
        </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

1 Answer, 1 is accepted

Sort by
0
Brett
Top achievements
Rank 2
answered on 24 Jul 2008, 07:42 PM
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

Tags
Grid
Asked by
Brett
Top achievements
Rank 2
Answers by
Brett
Top achievements
Rank 2
Share this question
or