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.
|
|