Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i have datatable with some columns and rows..
and i fill listview from datatable in DataPager1_PreRender...

Also i have checkboxlist OnSelectedIndexChanged , i want to filter from datatable and fill listview according to checkbox selected

When i do this, the page reloads and shows results..what i want is only listview (that much div part) should be reload/refresh and page should remain at same position...


I used <updatepanel>,maintainpagescrollposition true , but still it page reloads ...

pls advice
Posted
Comments
JoCodes 29-Jan-14 3:59am    
Whats the code you tried?
maulikshah1990 29-Jan-14 4:04am    
The code in aspx is ........

<updatepanel>
<contenttemplate>
<asp:CheckBoxList ID="chkCountries" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Country_Selected">
<asp:ListItem Text="rating 5" Value="5"><span class="Fivestar_ft"></span>
<asp:ListItem Text="rating 4" Value="4"><span class="Fourstar_ft"></span>
<asp:ListItem Text="rating 3" Value="3"><span class="Threestar_ft"></span>
<asp:ListItem Text="rating 2" Value="2"><span class="Twostar_ft"></span>




<asp:ListView ID="ProductListList" runat="server" >
<layouttemplate>
<blockquote>
<asp:PlaceHolder runat="server" ID="itemPlaceholder">
</blockquote>

<itemtemplate>
<p><%#Eval("Hoteldescp") %></p>










The code in aspx.cs is

protected void Page_Load(object sender, EventArgs e)
{
ProductListList.Page.MaintainScrollPositionOnPostBack = true;
DataTable table_temp = (DataTable)Session["SearchHotel"];
ProductListList.DataSource = table_temp;
}

protected void DataPager1_PreRender(object sender, EventArgs e)
{
}



}



protected void Country_Selected(object sender, EventArgs e)
{

filter.Append(" tester = '" + Cntyitem.Value + "'");
dv.RowFilter = filter.ToString();

table_temp_f = dv.ToTable();

ProductListList.DataSource = table_temp_f;

}




this is code i use

1 solution

Hi,


C#
protected void Page_Load(object sender, EventArgs e)
{

if(!Page.IsPostBack)
{      
  ProductListList.Page.MaintainScrollPositionOnPostBack = true;
DataTable table_temp = (DataTable)Session["SearchHotel"];
 ProductListList.DataSource = table_temp;
}
}


Add in Page load like above.

User AJAX Update Panel for you ListView for partial reload.
 
Share this answer
 
Comments
maulikshah1990 29-Jan-14 4:36am    
But is my procedure correct in above code...

and I tried your above code with asp:Update panel, but page reloads again...
what is difference between ajax updatepanel and asp:update panel...how to use both..pls give example
maulikshah1990 29-Jan-14 5:43am    
waiting

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900