Click here to Skip to main content
11,702,396 members (74,662 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0
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
Posted 20-Dec-12 20:27pm
Edited 20-Dec-12 21:44pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use Trigger
 </ContentTemplate>
 
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
    </Triggers>
 
</asp:UpdatePanel>
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

.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
}
  Permalink  
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 515
1 Sergey Alexandrovich Kryukov 355
2 OriginalGriff 299
3 CHill60 145
4 Mika Wendelius 115
0 OriginalGriff 8,369
1 Sergey Alexandrovich Kryukov 7,547
2 CPallini 4,922
3 Maciej Los 4,411
4 Mika Wendelius 3,556


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 21 Sep 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100