2014-09-22 67 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