View Single Post
Old 05-19-2011, 01:20 PM   #1
9569zpaa
 
Posts: n/a
Default ListView DataPager gambol problem page

ListView and DataPager file page with the tutorial to do, I feel so chilly is quite convenient apt use in their projects above Shique a problem,GHD Precious Gift Set, specifically in the bound click Next or page digit ingredients usually or two to respond, and periodically wildly page.
test code favor this:
publicpartialclass ListViewTest: System.Web.UI.Page

protectedvoid Page_Load (objectif (! Page.IsPostBack)
; BindData ();

protectedvoid BindData ()

DBDataContext db = new DBDataContext ();
; var ds = db.Category;
ListView1.DataSource = ds;
ListView1.DataBind ();
db.Dispose ();

}
mentioned problems occur such as begin,GHD Hair Straightener, to detect causes for a long time yet could not detect a bbs in a diplomatic nation was found aboard the same ship folk,GHD IV Mini Straighteners, some experts have a solution given the data in the Page_Load Page_PreRender leap to push in That is:
publicpartialclass ListViewTest: System.Web.UI.Page
{
protectedvoid Page_Load (object / / / / BindData ();
protectedvoid Page_PreRender (object sender, EventArgs e)

BindData ();

protectedvoid BindData ()

DBDataContext db = new DBDataContext ();
; var ds = db.Category;
ListView1.DataSource = ds;
ListView1.DataBind ();
db.Dispose ();

}
tried the page is it truly natural Page_Load come also late? Unknown In adding, there namely a course equally viable:
publicpartialclass ListViewTest: System.Web.UI.Page

protectedvoid Page_Load (objectif (,GHD Pink Limited Edition! Page.IsPostBack)
; BindData ();

protectedvoid Page_PreRender (object / / BindData ();
protectedvoid ListView1_PagePropertiesChanging (object sender,GHD Straighteners, PagePropertiesChangingEventArgs e)
{
DataPager1.SetPageProperties (e.StartRowIndex, e.MaximumRows, falseprotectedvoid BindData ()

DBDataContext db = new DBDataContext ();
var ds = db.Category;
ListView1.DataSource = ds;
; ListView1.DataBind ();
db.Dispose ();

}


http://www.dotblogs.com.tw/jero/archive/2008/03/28/2344.aspx


To solve this problem have to be alleged in the ListView control OnPagePropertiesChanging events, and the implementation of the DataPager's
SetPageProperties usage, the specimen code as usual: To determination this problem must be declared in the ListView control
OnPagePropertiesChanging memorabilia, and act The DataPager's SetPageProperties method, the sample code as follows:

protected void Page_Init (object sender, EventArgs e)

{
ListView2.PagePropertiesChanging + = ListView2.PagePropertiesChanging + =
new EventHandler (ListView2_PagePropertiesChanging); current EventHandler (ListView2_PagePropertiesChanging);
}
void ListView2_PagePropertiesChanging (object sender, PagePropertiesChangingEventArgs e) void ListView2_PagePropertiesChanging (object sender, PagePropertiesChangingEventArgs e)
{
ListView srcListView = sender as ListView; ListView srcListView = sender for ListView;
this. DataPager1.SetPageProperties (e.StartRowIndex, e.MaximumRows, artificial); this. DataPager1.SetPageProperties (e.StartRowIndex,GHD Hair, e.MaximumRows, false);
srcListView.DataBind ();
}
http://blog.miniasp.com/post/2008/04/Problem-in-ListView-with -DataPager-when-not-using-LinqDataSource.aspx

http://blog.csdn.net/zishuijingruyan/archive/2008/04/17/2300370.aspx
  Reply With Quote

Sponsored Links