
Hi! I have a problem with the RadGrid, I am show a lot data en grid using paging, but if I select another page the radgrid show-off
i hope your help.
This is my code:
RadGrid1.DataSource = data.Query("NoTarjeta", selectsNoTarjeta, "NoTarjeta", toSearch, "%");
RadGrid1.DataBind();
The method Query is:
public DataSet Query(String type, String selects, String paramWhere, String compare, String comodin)
{
List<string> byTable = new List<string>();
String Query = null;
byTable=searchTables(type);
foreach (string table in byTable) // Loop through List with foreach
{
Query = "SELECT " + selects + " FROM " + table + " WHERE " + paramWhere + " LIKE '" + compare + comodin + "' UNION ALL " + Query;
}
Query = Query.Substring(0, Query.Length - 10);
ConnectToDatabase("localhost", 3306, "data", "root", "xxx");
MySqlDataAdapter adapter = new MySqlDataAdapter(Query, Userconection);
adapter.Fill(Results);
Userconection.Close();
return Results;
}
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"
width="994px">
<asp:TextBox ID="txSearch" runat="server" Width="343px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<br />
<telerik:RadGrid ID="rgResults" runat="server" AllowPaging="True"
AllowSorting="True" Skin="Telerik">
</telerik:RadGrid>
</telerik:RadAjaxPanel>
<telerik:RadTabStrip runat="server" ID="TabStrip1" MultiPageID="Multipage1"
SelectedIndex="0">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="sqldatasource1">
<MasterTableView DataKeyNames="CustomerID" >
<ExpandCollapseColumn Visible="True">
</ExpandCollapseColumn>
<NestedViewTemplate>
<telerik:RadTabStrip runat="server" ID="TabStrip1" MultiPageID="Multipage1"
SelectedIndex="0">
<Tabs>
<telerik:RadTab runat="server" Text="Orders" PageViewID="PageView1">
</telerik:RadTab>
<telerik:RadTab runat="server" Text="Contact Information" PageViewID="PageView2">
</telerik:RadTab>
<telerik:RadTab runat="server" Text="Statistics Chart" PageViewID="PageView3">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" ID="Multipage1" RenderSelectedPageOnly="false">
<telerik:RadPageView runat="server" ID="PageView1">
<asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("CustomerID") %>'
runat="server" />
PageView 1
<telerik:RadGrid runat="server" ID="RadGrid2">
<MasterTableView DataSourceID="SqlDataSource2">
<Columns>
<telerik:GridBoundColumn DataField="OrderDate"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="Data Source=SQLExpress;Initial Catalog=Northwind;Integrated Security=true;"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Orders Where CustomerID = @CustomerID"
runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="CustomerID" />
</SelectParameters>
</asp:SqlDataSource>
</telerik:RadPageView>
</telerik:RadMultiPage>
</NestedViewTemplate>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=SQLExpress;Initial Catalog=Northwind;Integrated Security=true;" SelectCommand="select * from customers"
></asp:SqlDataSource>
Many thanks
andrea
| Protected Sub rgPromos_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rgPromos.ItemCommand |
| If e.CommandName = RadGrid.FilterCommandName Then |
| Dim filterPair As Pair = CType(e.CommandArgument, Pair) |
| Dim colName As String = filterPair.Second.ToString() |
| If colName = "PromotionCode" Then |
| Dim tbPattern As TextBox = CType((CType(e.Item, GridFilteringItem))(colName).Controls(0), TextBox) |
| PromoCodeFilter = tbPattern.Text |
| PromoCodeFilterOperator = filterPair.First.ToString() |
| rgPromos.Rebind() |
| End If |
| End Sub |