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

Rad grid Dispalying page not reset when data source change

3 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wella
Top achievements
Rank 1
Wella asked on 05 Jun 2013, 12:00 PM
I have created asp webpage with rad grid . i have used Telerik.Web.UI.dll  version 2008.01.0415.35 .
In here i change data source according to drop down list change.
Issue is when i change display page and change data source rad grid still showing lastly i selected displaying page.

I have attached image
In here data source consists with 10 records. when i change display page by clicking go button on rad grid it will show first page with records.
In here i need to set fist page when data source change in rad grid

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Jun 2013, 04:44 AM
Hi.

Please take a look into the following code snippet I tried.

ASPX:
<asp:DropDownList ID="ddl" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddl_SelectedIndexChanged">
    <asp:ListItem Text="SqlDataSource1"></asp:ListItem>
    <asp:ListItem Text="SqlDataSource2"></asp:ListItem>
    <asp:ListItem Text="SqlDataSource3"></asp:ListItem>
</asp:DropDownList>
<telerik:RadGrid ID="RadGrid1" runat="server"  AllowPaging="true" PageSize="2">
    <MasterTableView>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
    datasource = ddl.SelectedItem.Text;
    RadGrid1.DataSourceID = datasource;
    RadGrid1.Rebind();
}

Please provide your code if it doesn't help.

Thanks,
Shinu.
0
Wella
Top achievements
Rank 1
answered on 06 Jun 2013, 05:23 AM
Thank yo shinu your reply,

Please find the attached image . Issue is displaying page.

when i bind a large dataset into a rad grid it dispaly "Displaying page 1 of 4717, items 1 to 10 of 47167". then i chage the selected page index to the last page. later i rebind a dataset which is not as large as the previous dataset. than the page index remain unchange. therefore no records are displaying in the grid. message remain as " Displaying page 4717 of 1, items 47167 to 0 of 0".
0
Eyup
Telerik team
answered on 10 Jun 2013, 07:19 AM
Hello Wella,

Can you please verify that you are not using DataBind() ? Please note that performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding

Hope this helps.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Wella
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Wella
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or