2014-09-22 65 views
0

我有一个gridview,当你点击一个单元格时,它会填充gridview1传递给gridview2的会话参数的另一个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> 

公用Sub WebDataGrid1_CellSelectionChanged(发送者为对象,例如作为Infragistics.Web.UI.GridControls.SelectedCellEventArgs)处理WebDataGrid1.CellSelectionChanged 点心pressName = e.CurrentSelecte dCells(0)。文本 会议( “pressName”)= pressName WebDataGrid2.DataBind() 完子

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

回答

0

尝试把GridView1在GRidview2

的相同的UpdatePanel

从SqlDataTesting2删除的SelectCommand然后在WebDataGrid1_CellSelectionChanged

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

    SqlDataTesting2.databind() 

    WebDataGrid2.DataBind() 
+0

谢谢,但没有工作 – Dman 2014-09-22 21:00:00

+0

当我通过更新panel_load事件加强它表明,所有的参数都被填充正确BU t然而,当页面显示它不显示新的数据 – Dman 2014-09-22 21:01:02

+0

我修改答案尝试so.If不工作尝试条件,如果不是ispostback然后WebDataGrid1.DataBind()endif – 2014-09-22 21:19:13