Problem with refresh radlistview

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

    Posted 22 Feb 2013 Link to this post

    hi...

    this is my web page where i use a radlistview:
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="ImageButtonRicerca">
    <UpdatedControls>
    <telerik:AjaxUpdatedControl ControlID="Panel1"
    LoadingPanelID="RadAjaxLoadingPanel1" />
    </UpdatedControls>
    </telerik:AjaxSetting>
    </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server"
    DecoratedControls="Textbox" Skin="Sunset" />
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
    Skin="Simple" BorderColor="#D5842B" BorderStyle="Double" BorderWidth="1px">
    </telerik:RadAjaxLoadingPanel>
    <div align="center" class="backgroundup">
    <div align="center" class="banner">
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="85px" width="1024px">
    <div style="padding-left:200px;">
    <div class="profilesearch">
    <asp:Panel ID="Panel1" runat="server" DefaultButton="ImageButtonRicerca" Height="55px">
    <table style="width:620px; padding-top:6px">
    <tr>
    <td style="width: 360px; margin: 0px; border: 0px; padding: 0px; text-align: right;">
    <telerik:RadTextBox ID="Txt_ricerca1" Runat="server"
    EmptyMessage="Nominativo o azienda o categoria" Width="350px" Height="23px" Skin="" Font-Italic="True"
    Font-Names="Verdana">
    <EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
    <HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
    </telerik:RadTextBox>
    </td>
    <td style="width: 260px; margin: 0px; border: 0px; padding: 0px; text-align: left;">
    <telerik:RadTextBox ID="txt_ricerca2" Runat="server"
    EmptyMessage="Città di residenza" Width="250px" Height="23px" Skin="" Font-Italic="True"
    Font-Names="Verdana">
    <EmptyMessageStyle ForeColor="Gray" Font-Italic="True" Font-Names="Verdana" />
    <HoveredStyle Font-Italic="True" Font-Names="Verdana" ForeColor="#993300" />
    </telerik:RadTextBox>
    </td>
    <td style="width: 80px; margin: 0px; border: 0px; padding: 0px;">
    <asp:ImageButton ID="ImageButtonRicerca" runat="server"
    ImageUrl="~/Image/cerca.png" />
    </td>
    </tr>
    </table>
    </asp:Panel>
    </div>
    </div>
    </telerik:RadAjaxPanel>
    </div>
    <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Width="700px"
    HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">
    <div class="divresultmenu">
    <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2010Silver"
    OnItemClick="RadMenu1_ItemClick">
    <Items>
    <telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
    Text="Home page" Owner="RadMenu1">
    </telerik:RadMenuItem>
    <telerik:RadMenuItem runat="server" IsSeparator="True" Text="Root RadMenuItem2">
    </telerik:RadMenuItem>
    <telerik:RadMenuItem runat="server" Font-Names="Verdana" Font-Size="Small"
    Text="Registrati in Trycontact">
    </telerik:RadMenuItem>
    </Items>
    </telerik:RadMenu>
    </div>
    <div class="resultseparator">
    </div>
    <div style="font-family:Verdana" id="div_radlistview">
    <telerik:RadListView ID="RadListView1" runat="server" DataKeyNames="idutente"
    ItemPlaceholderID="Contenitore" AllowPaging="True" Skin="Office2010Silver"
    Width="655px">
    <LayoutTemplate>
    <fieldset id="FieldSet1">
    <legend>Risultati della ricerca:</legend>
    <asp:PlaceHolder ID="Contenitore" runat="server"></asp:PlaceHolder>
    <div>
    <div style="float: left; margin-left: 30%;">
    <telerik:RadButton ID="btnFirst" runat="server" Text="Prima" CommandName="Page" CommandArgument="First"
    Enabled="<%#Container.CurrentPageIndex > 0 %>" Skin="Office2010Silver">
    </telerik:RadButton>
    <telerik:RadButton ID="btnPrev" runat="server" Text="Precedente" CommandName="Page" CommandArgument="Prev"
    Enabled="<%#Container.CurrentPageIndex > 0 %>" Skin="Office2010Silver">
    </telerik:RadButton>
    <span style="vertical-align: top; position: relative; top: 4px">Pagina
    <%#Container.CurrentPageIndex + 1 %>
    di
    <%#Container.PageCount%></span>
    <telerik:RadButton ID="btnNext" runat="server" Text="Successiva" CommandName="Page" CommandArgument="Next"
    Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" Skin="Office2010Silver">
    </telerik:RadButton>
    <telerik:RadButton ID="btnLast" runat="server" Text="Ultima" CommandName="Page" CommandArgument="Last"
    Enabled="<%#Container.CurrentPageIndex + 1 < Container.PageCount %>" Skin="Office2010Silver">
    </telerik:RadButton>
    </div>
    </div>
    </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>
    </div>
    </telerik:RadAjaxPanel>
    <div align="center" style="background-image: url('Image/backgroundTeca2.jpg'); background-repeat: repeat-x; height: 33px;" id="under">
    </div>
    </div>
    </form>

    this is my code behind with i load racord in the radlistview:


    Imports System
    Imports System.Data
    Imports System.Web
    Imports System.Data.SqlClient
    Imports Telerik.Web.UI
    Imports System.IO
    Imports System.Web.UI.HtmlControls
         
    Private Loadsearch As New GestoreUtente
    #Region "routine"
        Private Sub Carica_risultati(ByVal _str1 As String, ByVal _str2 As String)
            Dim lista As List(Of PropertyUtente) = Loadsearch.Search(_str1, _str2)
            RadListView1.DataSource = lista
            RadListView1.DataBind()
        End Sub
    #End Region
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                Dim _str1, _str2 As String
                _str1 = Request.QueryString("_str1")
                _str2 = Request.QueryString("_str2")
                Carica_risultati(_str1, _str2)
            End If
        End Sub
     
        Protected Sub ImageButtonRicerca_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) Handles ImageButtonRicerca.Click
            Carica_risultati(Txt_ricerca1.Text, Txt_ricerca2.Text)
        End Sub

    When i load this page of another page and start the event page_load, the record in the radlistview see all perfect.
    But if i start the search in this page and i click on button search, the query sql function perfect and load the new record but dont see in the radlsitview. i always see the same records...why?

  2. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 27 Feb 2013 Link to this post

    Hello,

     It seems there is a problem with the ajax settings on the page. We recommend using either RadAjaxManager or RadAjaxPanel on the page, but not simultaneously both of them because this can cause issues. You can try to disable all the ajax on the page and verify that the databinding logic for the ListView works as expected (including the case with the search button). Additionally you can also utilize the advanced databinding approach of the control to provide more versatile options in various scenarios. Once you make sure that the page works correctly without ajax you can go for ajaxifying the controls using the preferred approach (either RadAjaxManager or RadAjaxPanel). More information can also be found here:
    http://www.telerik.com/help/aspnet-ajax/listview-declarative-definition.html (ajaxifying with RadAjaxPanel)

    Greetings,
    Marin
    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
Back to Top