Datapage not coming back

6 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 24 Feb 2013 Link to this post

    Hello,

    before this is my html code and vb.bet code:
    <asp:Panel ID="PanelRadlist" runat="server" Width="700px">
    <div style="font-family:Verdana; width:65" id="div_radlistview">
    <telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="idutente"
    ItemPlaceholderID="Contenitore" AllowPaging="True" Skin="Office2010Silver"
    Width="650px" OnPageIndexChanged="RadListView1_PageIndexChanged">
    <LayoutTemplate>
    <fieldset style="width: 700px; border:0px" id="FieldSet1">
    <legend></legend>
    <asp:Panel ID="Contenitore" runat="server">
    </asp:Panel>
    </fieldset>
    </LayoutTemplate>
    <ItemTemplate>
    <div class="item">
    <div class="image">
    <asp:Image ID="Image1" runat="server" ImageUrl='<%# CType(Container.DataItem, PropertyUtente).imageprofile%>' Height="120px" Width="110px"/>
    </div>
    <div class="content">
    <div class="user">
    <b><%# CType(Container.DataItem, PropertyUtente).utente%></b>
    </div>
    <div class="description_category">
    Categoria: <%# CType(Container.DataItem, PropertyUtente).Desccategoria%>
    </div>
    <div class="description_city">
    Città: <%# CType(Container.DataItem, PropertyUtente).Desccomune%></div>
    <div class="description_phone">
    Telefono: <%# CType(Container.DataItem, PropertyUtente).Telefono%></div>
    <div class="description_email">
    Email: <%# CType(Container.DataItem, PropertyUtente).Email%>
    </div>
    <div class="item_button">
    <telerik:RadButton ID="RadButton1" runat="server" Text="Visualizza biglietto completo" Width="170px" Skin="Office2010Silver"
    OnClick="RadButton1_Click">
    </telerik:RadButton>
    </div>
    </div>
    </div>
    </ItemTemplate>
    </telerik:RadListView>
    <telerik:RadDataPager ID="RadDataPager1" runat="server"
    PagedControlID="RadListView1" Culture="it-IT" Width="700px">
    <Fields>
    <telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
    <telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
    <telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
    </Fields>
    </telerik:RadDataPager>
    </div> <!-- end div radlist -->
    </asp:Panel>

    Imports System
    Imports System.Web
    Imports System.Data
    Imports System.Data.SqlClient
    Imports Telerik.Web.UI
    Imports System.Web.UI.HtmlControls
    Imports System.IO
    Imports TRYcontact
     
    Public Class search
        Inherits RadAjaxPage
        Private ObjUtente As New PropertyUtente
        Private Loadsearch As New GestoreUtente
        Private Sub Carica_risultati(ByVal _str1 As String, ByVal _str2 As String)
            Dim lista As List(Of PropertyUtente) = Loadsearch.Search(_str1, _str2)
            label1.text = "Risultati trovati: " & CInt(lista.Count)
            RadListView1.DataSource = lista
            RadListView1.DataBind()
        End Sub
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Page.IsPostBack Then
                Dim _str1, _str2 As String
                _str1 = Request.QueryString("_str1")
                _str2 = Request.QueryString("_str2")
                Carica_risultati(_str1, _str2)
                Me.ClientScript.RegisterStartupScript(Me.GetType, "", "Height_Div();", True)
            End If
        End Sub
     
        Protected Sub RadButton1_Click(sender As Object, e As System.EventArgs)
            Dim Button As RadButton = CType(sender, RadButton)
            Dim item As RadListViewDataItem = CType(Button.Parent, RadListViewDataItem)
            Dim dd As Integer = item.GetDataKeyValue("idutente")
            Response.Redirect("publicard.aspx?_id=" & item.GetDataKeyValue("idutente"))
        End Sub
     
        Protected Sub RadListView1_PageIndexChanged(sender As Object, e As Telerik.Web.UI.RadListViewPageChangedEventArgs) Handles RadListView1.PageIndexChanged
            RadListView1.CurrentPageIndex = e.NewPageIndex
            Dim _str1, _str2 As String
            _str1 = Request.QueryString("_str1")
            _str2 = Request.QueryString("_str2")
            Carica_risultati(_str1, _str2)
        End Sub
    End Class
    now the my problem is that  that when I click on the next button to go forward with the record, the selection of the next page is not the case still remains the number one and then if I click on button press or back first, the pages do not come back and you do not see the change records.
    look at the picture I posted
    And another question..it is possible that when I click on DataPage to change the page, being the property PageSize = 10, the display of the page to look back at the first record in high .. then come back as if the scrollbar on it ... like in google
    i used this code: 

     

    ScriptManager.RegisterStartupScript(Page, Me.GetType, "Goon", "window.scrollTo(0,0);", True)

    but is only a refresh of Pgina and the scrollbar is always positioned at the bottom so the page does not return at the beginning of the list.




  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 28 Feb 2013 Link to this post

    Hello Fabio,

    Generally the RadDataPager should be placed inside the LayoutTemplate of the RadListView. In your case the markup definition should look like this:
    <telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="idutente" ItemPlaceholderID="Contenitore"
            AllowPaging="True" Skin="Office2010Silver" Width="650px" OnPageIndexChanged="RadListView1_PageIndexChanged">
            <LayoutTemplate>
                <fieldset style="width: 700px; border: 0px" id="FieldSet1">
                    <legend></legend>
                    <asp:Panel ID="Contenitore" runat="server">
                    </asp:Panel>
                    <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListView1"
                        Culture="it-IT" Width="700px">
                        <Fields>
                            <telerik:RadDataPagerButtonField FieldType="FirstPrev"></telerik:RadDataPagerButtonField>
                            <telerik:RadDataPagerButtonField FieldType="Numeric"></telerik:RadDataPagerButtonField>
                            <telerik:RadDataPagerButtonField FieldType="NextLast"></telerik:RadDataPagerButtonField>
                        </Fields>
                    </telerik:RadDataPager>
                </fieldset>
            </LayoutTemplate>
            <ItemTemplate>
                <div class="item">
                    <div class="image">
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# CType(Container.DataItem, PropertyUtente).imageprofile%>'
                            Height="120px" Width="110px" />
                    </div>
                    <div class="content">
                        <div class="user">
                            <b>
                                <%# CType(Container.DataItem, PropertyUtente).utente%></b>
                        </div>
                        <div class="description_category">
                            Categoria:
                            <%# CType(Container.DataItem, PropertyUtente).Desccategoria%>
                        </div>
                        <div class="description_city">
                            Città:
                            <%# CType(Container.DataItem, PropertyUtente).Desccomune%></div>
                        <div class="description_phone">
                            Telefono:
                            <%# CType(Container.DataItem, PropertyUtente).Telefono%></div>
                        <div class="description_email">
                            Email:
                            <%# CType(Container.DataItem, PropertyUtente).Email%>
                        </div>
                        <div class="item_button">
                            <telerik:RadButton ID="RadButton1" runat="server" Text="Visualizza biglietto completo"
                                Width="170px" Skin="Office2010Silver" OnClick="RadButton1_Click">
                            </telerik:RadButton>
                        </div>
                    </div>
                </div>
            </ItemTemplate>
        </telerik:RadListView>

    I strongly suggest that you examine this demo which demonstrates how to use RadDataPager for paging inside a RadListView. I suppose that you are using RadAjax and probably the pager is not updated after the ajax request and that is why the page index is not updated. This issue should be resolved automatically when you place the pager inside the LayoutTemplate.

    As for your second requirement I am experiencing difficulties understanding it. Could you please clarify what do you mean by display of the page to look back at the first record in high? Please explain in more detail what exactly you want to implement so we could advise you further.

    All the best,
    Angel Petrov
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 04 Mar 2013 Link to this post

    Hello Angel,
    the first problem was solved. But now there is another problem..the field of radlistview I have a button that opens another page with a redirect apsx. with the name of card.aspx. when I close the card.aspx to return to the page where there is radlistview I would like the DataPager to remain the selected page. however if I do a redirect to close the page card.aspx, having on page_load loading the record from the database and also in the event NeedDataSource, the radpage back to the first page because charging records from the beginning. If you close the page card.aspx with a querystring variable that is used in a cycle if I can not to load the data in the page load and NeedDataSource radlistview but find it empty .. how can I solve this problem?

    Maybe you had the index of the current page of the radpage .. I could save it in a viariabile and when I close the page card.aspx, this recovery index and load radpage so I'm always on the last page of radpage open
  5. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 06 Mar 2013 Link to this post

    Hi Fabio,

    A possible resolution for this problem should definitely include storing the page index(for example in the Session). In the click event handler of the button that redirects to another page you can extract the CurrentPageIndex like demonstrated in the code snippet below:
    protected void RedirectClick_Click(object sender, EventArgs e)
        {
            Session["CurrentPageIndex"] = RadListView1.CurrentPageIndex;
            Response.Redirect("~/Default2.aspx");
        }

    Later when you load the page again you will use the value stored in the session to change the page index of the RadListView:
    protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["CurrentPageIndex"] != null)
            {
                RadListView1.CurrentPageIndex = int.Parse(Session["CurrentPageIndex"].ToString());
                RadListView1.Rebind();
                Session["CurrentPageIndex"] = null;
            }
        }

    By following this approach you should be able to persist the paging.

    Regards,
    Angel Petrov
    the Telerik team
    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 their blog feed now.
  6. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 06 Mar 2013 Link to this post

    Hi,
    ok!!! the property Radlistview.Rebind what is?

    and i use this code too:

    Protected Sub RadListView1_NeedDataSource(sender As Object, e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles RadListView1.NeedDataSource
    search_result(_search.Value, _search1.Value)
    End Sub

    and after  cameback in the radlistview page, start this code too and load all records...here sub i must do the control of the code as in page_load event?

  7. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 11 Mar 2013 Link to this post

    Hi Fabio,

    The Rebind() is a method which will force rebind of the grid and will refresh its state. I suggest you to check out the following help topic which elaborate more on Advanced DataBinding.

    Regards,
    Kostadin
    the Telerik team
    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 their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017