0

我有一个gridview,当您单击一个单元格时,它会使用从gridview1传递到gridview2的会话参数填充另一个gridview

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
              <ContentTemplate>

                   <ig:WebDataGrid ID="WebDataGrid2" runat="server" Width="400px" 
                       AutoGenerateColumns="False" DataSourceID="SqlDataTesting2">
                       <Columns>
                           <ig:BoundDataField DataFieldName="PressName" Key="PressName">
                               <Header Text="PressName" />
                           </ig:BoundDataField>
                           <ig:BoundDataField DataFieldName="MinWidth" Key="MinWidth">
                               <Header Text="MinWidth" />
                           </ig:BoundDataField>
                           <ig:BoundDataField DataFieldName="MinHeight" Key="MinHeight">
                               <Header Text="MinHeight" />
                           </ig:BoundDataField>
                           <ig:BoundDataField DataFieldName="MaxWidth" Key="MaxWidth">
                               <Header Text="MaxWidth" />
                           </ig:BoundDataField>
                           <ig:BoundDataField DataFieldName="MaxHeight" Key="MaxHeight">
                               <Header Text="MaxHeight" />
                           </ig:BoundDataField>
                       </Columns>
                   </ig:WebDataGrid>
                   <asp:SqlDataSource ID="SqlDataTesting2" runat="server" 
                       ConnectionString="<%$ ConnectionStrings:masterConnectionString %>" 
                       ****SelectCommand="SELECT [PressName], [MinWidth], [MinHeight], [MaxWidth], [MaxHeight] FROM [PressInfoNew] WHERE ([PressName] = @PressName) ORDER BY [PressName]">****
                       <SelectParameters>
                           <asp:SessionParameter Name="pressName" SessionField="pressName" Type="String" />
                       </SelectParameters>
                   </asp:SqlDataSource>
               </ContentTemplate>
               </asp:UpdatePanel>

Public Sub WebDataGrid1_CellSelectionChanged(sender As Object, e As Infragistics.Web.UI.GridControls.SelectedCellEventArgs) Handles WebDataGrid1.CellSelectionChanged Dim pressName = e.CurrentSelectedCells(0).Text Session("pressName") = pressName WebDataGrid2.DataBind() End Sub

Public Sub UpdatePanel1_Load(sender As Object, e As System.EventArgs) Handles UpdatePanel1.PreRender
    WebDataGrid1.DataBind()
End Sub
4

1 回答 1

0

尝试将 GridView1 放在 GRidview2 的同一个 UpdatePanel 中

从 SqlDataTesting2 然后在 WebDataGrid1_CellSelectionChanged 中删除 selectcommand

SqlDataTesting2.selectcommand="SELECT [PressName], [MinWidth], [MinHeight], [MaxWidth], [MaxHeight] FROM [PressInfoNew] WHERE ([PressName] = pressName ) ORDER BY [PressName]"

    SqlDataTesting2.databind()

    WebDataGrid2.DataBind()
于 2014-09-22T20:33:05.607 回答