单击数据寻呼控件时,更新面板数据不会刷新 [英] Update Panel data is not refreshing when click on data Pager control

查看:93
本文介绍了单击数据寻呼控件时,更新面板数据不会刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

我在页面上实现了以下一个场景

MultiView

查看1

更新窗格1:内容搜索文本框和搜索按钮

更新进度:显示更新面板1的进度过程

更新面板2:此面板在列表视图中显示结果使用数据寻呼机控制

数据寻呼机控制适用于列表视图分页

注意:在更新面板控件中我没有使用任何触发器



问题:首先点击节点时,搜索结果数据会显示页数。

当第一次点击第2页时,Page得到回复但只有查询字符串值已更新

但数据未刷新

第二次再次单击同一页面时,数据刷新并更新查询字符串值



注意:它会带来所有数据并将其存储在会话中,然后在显示分页数据后那和搜索。这是一个现有的逻辑,我们必须通过改变这个逻辑解决问题

 <  < span class =code-leadattribute> asp:UpdatePanel     runat   =  server    ID   =  uppEvent2    UpdateMode   = 条件 < span class =code-keyword>>  

< ContentTemplate >
< div id = listview >
< asp:ListView runat = server ID < span class =code-keyword> = lstvEventDisplays ItemPlaceholderID = pnLayout OnItemDataBound = lstvEventDisplays_OnItemDataBound OnPagePropertiesChanging = lstvEventDisplays_OnPagePropertiesChanging >
< / asp:ListView >
< div style = margin-removed 40px;保证金已删除60px >
< div style = margin-removed 330px >
< asp:DataPager runat = server ID = dataPagerNumeric < span class =code-attribute> PagedControlID = lstvEventDisplays PageSize = 4 OnPreRender = dataPagerNumeric_OnPreRender QueryStringField = pageId >
< 字段 >
< asp:NumericPagerField ButtonType = 链接 ButtonCount = 10 NumericButtonCssClass = < span class =code-keyword>分页 CurrentPageLabelCssClass = currentPageLabel NextPreviousButtonCssClass = NumPaging / >
< / Fields >
< <温泉n class =code-leadattribute> / asp:DataPager >
< / div >
< ; / ContentTemplate >
< / asp:UpdatePanel >





我注意到另外一点,在页面加载中,当页面加载条件为if(!Page.IsPostBack)时总是得到Page.IsPostBack的值为false每次回发都会执行,

任何人都可以告诉我为什么会出现上述情况的问题。



等待回复,

谢谢

解决方案

使用触发器

 <   / ContentTemplate  >  

< 触发器 >
< asp:AsyncPostBackTrigger ControlID = btnSearch < span class =code-attribute> EventName
= 点击 / >
< / Triggers >

< / a sp:UpdatePanel >


。 aspx页面关注以下步骤

1. < b > ScriptManager < / b >
2. < b > UpdatePanel < / b >
3. < b > 触发更新面板的AsyncPostBackTrigger < / b >
4.使用OnPagePropertiesChanged事件绑定Listview与此事件触发器EventName和Bind Listview

//脚本管理器

< asp:ScriptManager ID = SM_Listview runat = 服务器 >
< / asp:ScriptManager > ;

// UpdatePanel

< asp:UpdatePanel ID = Listview_PagingUPanel runat = 服务器 >
< ContentTemplate >

// ListView
< asp:ListView ID = Repeater1 < span class =code-attribute> runat = server OnItemDataBound = Repeater1_ItemCommand O nPagePropertiesChanged = lv_PagePropertiesChanged >
< ItemTemplate >
<%#DataBinder.Eval(Container, DataItem.Subject%>
<% #DataBinder.Eval(Container, DataItem.cnt%>

< / ItemTemplate >
< / asp :ListView >

// Da taPager
< asp:DataPager ID = datapagerForListview < span class =code-attribute> runat = server PagedControlID = Repeater1 PageSize = 2 >
< 字段 >
< asp:NextP reviousPagerField ButtonType = 链接 ShowFirstPageButton = true ShowNextPageButton = false

ShowPreviousPageButton = false FirstPageText = 首先 / >
< asp:NumericPagerField ButtonType = < span class =code-keyword>链接 / >
< asp:NextPreviousPagerField ButtonType = 链接 ShowLastPageButton = true ShowNextPageButton = false

ShowPreviousPageButton = false LastPageText < span class =code-keyword> = 最后 / >
< / Fields >
< / asp:DataPager >

< / ContentTemplate >




//触发
< 触发器 >
< asp:AsyncPostBackTrigger ControlID = Repeater1 EventName = PagePropertiesChanged / >
< / Triggers >

// UpdatePanel结束
< / asp:UpdatePanel >


在.aspx中.cs ... .BindRepeater ononPagePropertiesChanged

protected void ListView1_PagePropertiesChanged(object sender,EventArgs e)
{
// BindRepeater
}


Hello All,
I have one the following scenario implemented on Page
MultiView
View 1
Update Pane 1 : Content Search Text Box and Search Button
Update Progress: Show the Progress process for Update Panel 1
Update Panel 2: This panel shows the result in List View with Data Pager control
Data Pager Control works for List View paging
Note: In Update Panel control I have not use any trigger

Issue: At first when click on node the search result data displays with number of pages.
When click on page 2 first time only, Page get post back but only the query string value is updated
But the data is not get refresh
When again click on the same page Page2 second time, the data get refresh and the query string value is updated

Note: It brings all the data and store it in session and then after showing the paging data base on that and searching. It’s a existing logic and we have to solve the issue with the change in this logic

 <asp:UpdatePanel runat="server" ID="uppEvent2" UpdateMode="Conditional">
                    
      <ContentTemplate>
           <div id="listview">
                <asp:ListView runat="server" ID="lstvEventDisplays" ItemPlaceholderID="pnLayout" OnItemDataBound="lstvEventDisplays_OnItemDataBound" OnPagePropertiesChanging="lstvEventDisplays_OnPagePropertiesChanging">
                </asp:ListView>
                <div style="margin-removed 40px; margin-removed 60px">
                   <div style="margin-removed 330px">
                      <asp:DataPager runat="server" ID="dataPagerNumeric" PagedControlID="lstvEventDisplays" PageSize="4" OnPreRender="dataPagerNumeric_OnPreRender" QueryStringField="pageId">
                         <Fields>
                              <asp:NumericPagerField ButtonType="Link" ButtonCount="10" NumericButtonCssClass="Paging" CurrentPageLabelCssClass="currentPageLabel" NextPreviousButtonCssClass="NumPaging" />
                         </Fields>
                      </asp:DataPager>
                    </div>
      </ContentTemplate>
</asp:UpdatePanel>



One more point i notice, In Page load i always get the value of Page.IsPostBack as false, when the page load condition is if (!Page.IsPostBack) is always executed on every postback,
Can any one tell me why this issue come for the above scenario.

Waiting for reply,
Thank you

解决方案

Use Trigger

 </ContentTemplate>

    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
    </Triggers>

</asp:UpdatePanel>


.aspx page Follow Following Steps

1.<b>ScriptManager</b>
2.<b>UpdatePanel</b>
3.<b>Trigger AsyncPostBackTrigger of Update panel</b>
4. Use OnPagePropertiesChanged Event  to Bind Listview with trigger EventName and Bind Listview on this event

//Script Manager

<asp:ScriptManager ID="SM_Listview" runat="server">
        </asp:ScriptManager>

//UpdatePanel

 <asp:UpdatePanel ID="Listview_PagingUPanel" runat="server">
 <ContentTemplate>

//ListView
<asp:ListView ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemCommand" OnPagePropertiesChanged="lv_PagePropertiesChanged">
<ItemTemplate>
<%#DataBinder.Eval(Container,"DataItem.Subject")%>
<%#DataBinder.Eval(Container,"DataItem.cnt")%>

</ItemTemplate>
</asp:ListView>

//DataPager
<asp:DataPager ID="datapagerForListview" runat="server" PagedControlID="Repeater1" PageSize="2">
 <Fields>
  <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="true" ShowNextPageButton="false"

ShowPreviousPageButton="false" FirstPageText="First" />
<asp:NumericPagerField  ButtonType="Link" />
<asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="true" ShowNextPageButton="false"

  ShowPreviousPageButton="false" LastPageText="Last" />
</Fields>
</asp:DataPager>

</ContentTemplate>




//Trigger
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Repeater1" EventName="PagePropertiesChanged"/>
</Triggers>

//UpdatePanel Ended
</asp:UpdatePanel>


In .aspx.cs….BindRepeater on "onPagePropertiesChanged"

protected void ListView1_PagePropertiesChanged(object sender, EventArgs e)
    {
//BindRepeater
}


这篇关于单击数据寻呼控件时,更新面板数据不会刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆