by stchen » Tue, 13 Jun 2006 22:00:50
Hello Andrew,
Thank you for posting.
It seems that you're still struggling with the custom Gridview with custom
paging functionality. As for your 3 questions, I've just done some research
and struggle against the GridView. here are some of the results I got:
1.This does be an existing issue, and based on my reseach upon gridview's
code, when there is only one page needed, the GridView's certain PagerRow
will be set to Visible=False, we can consider set it to true in our
override "CreateChildControls" method. e.g.
========================
protected override void CreateChildControls()
{
base.CreateChildControls();
if(!this.DesignMode)
Context.Response.Write("<br/>Count: " + this.PageCount);
if (this.PageCount == 1)
{
if ((this.PagerSettings.Visible) &&
(this.PagerSettings.Position == PagerPosition.Bottom))
{
BottomPagerRow.Visible = true;
}
}
}
==============================
2. As for the context null reference issue, it is because when in IDE, the
HttpContext is not available, the control is hosted in VS IDE(designer
host). We can simply add code to determine the current context such as
if(Context != null)
{
}
or
if(!this.DesignMode)
{
}
3. As for the further question you mentioned:
================
Even if the above code worked properly I rather have the code in my first
post work to avoid so many nested tables (It's not really how modern web
pages should be designed!).
===============
I'm still not quite clear on this, do you mean that the pager need to be
created each time the control is loaded(in each page request)? And you want
to only create it once?
Please feel free to let me know if there is anything I didn't get.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)