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

[Solved] Page count inaccurate after new search

2 Answers 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig Smith
Top achievements
Rank 1
Craig Smith asked on 01 May 2008, 10:06 PM
I have a textbox that users use to search for records in the table. If they do a search that returns 100 records it correctly shows in the paging bar that there are 10 pages. If they then do another search and only 2 results are returned, the two results show correctly but the paging bar still says 10 pages. The records are updating but not the paging bar.

Here is the aspx...

<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager EnablePartialRendering="true" ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">  
    <ContentTemplate> 
    UWI:<telerik:RadTextBox ID="rtxtUWI" Runat="server">  
    </telerik:RadTextBox> 
    <asp:Button ID="btnSubmit" runat="server" Text="Go"   
        style="width: 31px" />&nbsp;<span style="color:Red;font-family:Arial;font-size:10px;">Complete or partial UWI (including "-" and "/")</span> 
        &nbsp;&nbsp;<asp:UpdateProgress ID="UpdateProgress1" runat="server">  
    <ProgressTemplate><div class="loading">  
        <img src="images/ajax-loader.gif" /></div></ProgressTemplate> 
    </asp:UpdateProgress> 
    </ContentTemplate> 
    </asp:UpdatePanel> 
    <div> 
      
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
    <ContentTemplate> 
      
        <br /> 
        <asp:Label ID="lblAgatsp" runat="server" Text="AGAT Sample Points"   
            Visible="False"></asp:Label> 
      
    <br /> 
    <telerik:RadGrid ID="rgInternal" runat="server" GridLines="None" DataSourceID="SqlDataSource1"   
              Skin="Vista" AllowSorting="True" ShowGroupPanel="True" Visible="False"   
            AllowFilteringByColumn="True" AllowPaging="True" AllowAutomaticUpdates="true" 
            AutoGenerateEditColumn="True" AutoGenerateColumns="false">  
<MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="ana_sample_point_id">  
<Columns> 
<telerik:GridBoundColumn HeaderText="Sample Point ID" DataField="ana_sample_point_id" Display="false" ReadOnly="true"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Barcode" DataField="Barcode" Display="true" ReadOnly="true"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Sample Point Name" DataField="SamplePointName" Display="true" ReadOnly="true"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="UWI" DataField="UWI" Display="true" ReadOnly="true"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Well Name" DataField="WellName" Display="true" ReadOnly="false"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Field" DataField="Field" Display="true" ReadOnly="false"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Pool" DataField="Pool" Display="true" ReadOnly="false"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Well License" DataField="WellLicense" Display="true" ReadOnly="false"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn HeaderText="Matrix" DataField="Matrix" Display="true" ReadOnly="true"></telerik:GridBoundColumn> 
 
</Columns> 
<RowIndicatorColumn Visible="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
<ExpandCollapseColumn Visible="False" Resizable="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
 
<EditFormSettings> 
<PopUpSettings ScrollBars="None"></PopUpSettings> 
</EditFormSettings> 
<PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
</MasterTableView> 
        <ClientSettings AllowDragToGroup="True">  
        </ClientSettings> 
        </telerik:RadGrid> 
        </ContentTemplate> 
    <Triggers> 
    <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="click" /> 
    </Triggers> 
    </asp:UpdatePanel> 
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">  
    <ContentTemplate> 
      
        <br /> 
        <asp:Label ID="lblEub" runat="server" Text="EUB Well Information"   
            Visible="False"></asp:Label> 
    <br /> 
    <telerik:RadGrid ID="rgEUB" runat="server" GridLines="None" DataSourceID="SqlDataSource2"   
                  Skin="Vista" AllowSorting="True" ShowGroupPanel="True"   
            Visible="False" AllowFilteringByColumn="True" AllowPaging="True">  
                <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
                <MasterTableView DataSourceID="SqlDataSource2">  
                    <RowIndicatorColumn Visible="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn Visible="False" Resizable="False">  
                        <HeaderStyle Width="20px"></HeaderStyle> 
                    </ExpandCollapseColumn> 
                    <EditFormSettings> 
                        <PopUpSettings ScrollBars="None">  
                        </PopUpSettings> 
                    </EditFormSettings> 
                </MasterTableView> 
                <ClientSettings AllowDragToGroup="True">  
                </ClientSettings> 
            </telerik:RadGrid> 
            <br /> 
    <asp:Label ID="lblFacility" runat="server" Text="EUB Facility Information"   
            Visible="False"></asp:Label> 
    <br /> 
    <telerik:RadGrid ID="rgFacility" runat="server" AllowFilteringByColumn="True"   
        AllowPaging="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True"   
        Skin="Vista" DataSourceID="SqlDataSource3" Visible="false">  
<PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
<MasterTableView datasourceid="SqlDataSource3">  
<RowIndicatorColumn Visible="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn Visible="False" Resizable="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
 
<EditFormSettings> 
<PopUpSettings ScrollBars="None"></PopUpSettings> 
</EditFormSettings> 
</MasterTableView> 
        <clientsettings allowdragtogroup="True">  
        </clientsettings> 
    </telerik:RadGrid> 
    </ContentTemplate> 
    </asp:UpdatePanel> 
    </div> 
      
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="OverwriteChanges" UpdateCommandType="Text" 
        ProviderName="System.Data.OracleClient"    
        ConnectionString=""   
         UpdateCommand="update ana_sample_points set  
         well_license = :WellLicense,  
         well_name = :WellName,  
         Field = :Field,  
         Pool = :Pool  
         where ana_sample_point_id = :ana_sample_point_id"  
         > 
        </asp:SqlDataSource> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ProviderName="System.Data.OracleClient" ConnectionString=""></asp:SqlDataSource> 
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ProviderName="System.Data.OracleClient" ConnectionString=""></asp:SqlDataSource> 
    </form> 
</body> 

And here is the .cs...

namespace HeaderInfoViewer  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (IsPostBack)  
            {  
                rgInternal.Visible = true;  
                rgEUB.Visible = true;  
                rgFacility.Visible = true;  
                lblAgatsp.Visible = true;  
                lblEub.Visible = true;  
                lblFacility.Visible = true;  
 
                setDataSources();  
                rgInternal.DataSource = null;  
                rgEUB.DataSource = null;  
                rgFacility.DataSource = null;  
            }  
        }  
          
        protected void setDataSources()  
        {  
            SqlDataSource1.SelectCommand = "select ana_sample_point_id,Barcode,Description SamplePointName, UWI, well_license WellLicense, well_name WellName, Field, Pool, Matrix from ana_sample_points where UWI like '%" + rtxtUWI.Text + "%'";  
            SqlDataSource2.SelectCommand = "select UWI, well_name Wellname, Fieldname, well_license WellLicense, PoolName, Well_Stat_Code, Licensee from eub_well,eub_field, eub_pool_field, eub_licenseecode " +  
                "where eub_well.fieldcode = eub_field.fieldcode(+) and (eub_well.poolcode = eub_pool_field.poolcode(+) and eub_well.fieldcode = eub_pool_field.fieldcode(+)) " +  
                "and eub_well.licenseecode = eub_licenseecode.eub_id_code(+) " +  
                "and uwi like '%" + rtxtUWI.Text + "%'";  
            SqlDataSource3.SelectCommand = "select UWI, FacilityID, Facility_Name, SubType_Name, License from eub_facility, eub_facility_subtype where eub_facility.subtype_code(+) = eub_facility_subtype.subtype_code and UWI like '%" + rtxtUWI.Text + "%'";  
        }  
    }  

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 02 May 2008, 05:36 AM
Hi Craig,

Go through the following forum links.

Rebind() not updating pager
Page and row count not in sync after changing datasource

Princy.
0
Craig Smith
Top achievements
Rank 1
answered on 02 May 2008, 05:52 AM
Specifically, setting this fixed it...

EnableLinqExpressions

="false"

Thanks!!!

Tags
Grid
Asked by
Craig Smith
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Craig Smith
Top achievements
Rank 1
Share this question
or