Tips & Tricks for ASP.NET - C#

Google site Search
AJAX paging Listview Datapager Codebehind query dynamic
Add
List View, Datapager,Sqldatasource,hiddenfield into update panel.

Connect datapager with list view by adding the propery PagedControlID="ListView1" on the datapager.

Configure the sqldatasource with a query

Connect the listview to the sqldatasource
go to the code part and remove the select query.

In the code behind (onpage load or any button press or any event) write the dynamic sql query and give the query to the hidden value.
on databound of listview call OnDataBound="SqlStatement"
code behind

public void SqlStatement(object sender, EventArgs e) {

sqlDsCandidates.SelectCommand = sqlQuery.Value; lblPage.Text = "Searched " Convert.ToString(DataPager1.TotalRowCount) " candidate(s)";
}

now on the event the dynamic query will be generated and paging will be done one that query.


Arvixe offers ASP.net hosting that's good for testing plugins. Here is a good arvixe review if you want to know more.

Comments
Heinz Says:-
“ Thanks dude, quick ajax pagin ”
 
 
Dan Says:-
“ Nice article, saved my time. ”
 
 
ashly Says:-
“ Never see this before ”
 
 
Thomachan Says:-
“ sweet and simple ”
 
 
Write Comments
Name  
Email    
Comments  

Other Titles