Dman
Dman

Reputation: 573

update panel not binding data

I have a gridview that when you click on a cell it populates another gridview with a sessions parameter passed from gridview1 to gridview2 I placed an update panel that gets the parameter from gridview1 then updates to rebind gridview2 However the gridview is not rebinding when updated

<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

Upvotes: 0

Views: 430

Answers (1)

Diego Farina
Diego Farina

Reputation: 339

Try put GridView1 in the same UpdatePanel of GRidview2

Remove selectcommand from SqlDataTesting2 then in WebDataGrid1_CellSelectionChanged

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

    SqlDataTesting2.databind()

    WebDataGrid2.DataBind()

Upvotes: 0

Related Questions