RE: RE: RE: Custom GridView Control – Postback Problems
- From: Amadeus Consulting <Amadeus@xxxxxxxxxxxxxxxx>
- Date: Tue, 20 Dec 2005 10:31:02 -0800
Steven,
A slight modification to your PreRender handler makes it (I think) something
you could recommend:
if (GridView1.PageCount == 1)
{
GridView1.TopPagerRow.Visible = true;
GridView1.BottomPagerRow.Visible = true;
}
I don't think this is dependant on the underlying implementation, and this
does work even when using Template Pager.
Thanks for your help.
--
Steve Loper
Amadeus Consulting
"Steven Cheng[MSFT]" wrote:
> Thanks for your response Steve,
>
> As for the GridView's pager, based on my research, this is a fixed behavior
> which is defined in the GridView's rendering part, so when there is only
> one page of data, there won't display the Pager , even if we use custom
> Pager Template......
>
> Currently what I can get is put the GridView into an HTML table which has
> two row, and put a seprate sub table (our pager ) in the second table
> row.... We can use the GridView's PreRender event to determine the page
> count, if page count is 1, we'll need to make the external pager element
> visible, elsewise, leave it invisible.....
>
> In addition, if you're using Template Pager... (define your own pager
> template....), we can use the following code in GridView's Prender event to
> make the pager row visible:
>
> protected void GridView1_PreRender(object sender, EventArgs e)
> {
> if (GridView1.PageCount == 1)
> { int count = GridView1.Controls[0].Controls.Count;
> GridView1.Controls[0].Controls[count - 1].Visible= true;
> }
> }
>
> the index I used is got from the page's output Trace... Anyway, this is
> somewhat depend on the underlying implementation of the GridView , so we're
> not recommended to use such means...
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
> --------------------
> | Thread-Topic: =?Utf-8?Q?RE:_Custom_GridView_Control_=E2=80=93_Po?=
> | =?Utf-8?Q?stback_Problems?=
> | thread-index: AcYEs997kMv0c9+URgmcyEyF5PLOJQ==
> | X-WBNR-Posting-Host: 65.103.98.1
> | From: =?Utf-8?B?QW1hZGV1cyBDb25zdWx0aW5n?= <Amadeus@xxxxxxxxxxxxxxxx>
> | References: <7867E55F-4456-45C9-B832-B72F1D1E8BB2@xxxxxxxxxxxxx>
> <A1146B99-D7E9-4604-9A7D-C75B25641133@xxxxxxxxxxxxx>
> <vsGrYneAGHA.616@xxxxxxxxxxxxxxxxxxxxx>
> | Subject: =?Utf-8?Q?RE:_RE:_Custom_GridView_Control_?=
> | =?Utf-8?Q?=E2=80=93_Postback_Problems?=
> | Date: Mon, 19 Dec 2005 07:50:02 -0800
> | Lines: 59
> | Message-ID: <69C80849-2EB3-4025-BA23-427EBE82164E@xxxxxxxxxxxxx>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 7bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
> | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | Xref: TK2MSFTNGXA02.phx.gbl
> microsoft.public.dotnet.framework.aspnet.webcontrols:31893
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
> |
> | Steven,
> |
> | Thanks for the response. We have done what you suggested (created the
> | composite control), and that works for the most part.
> |
> | Most of what we are tring to do is display some customs via the
> | PagerTemplate. This is now working very well when there is more than one
> page
> | of data. If there is only one page of data, the PagerTemplate is not
> | displayed. This appears to be the default behaviour of the GridView
> control.
> | Is there any way to force the GridView control to display the
> PagerTemplate
> | when there is only a single page of data?
> |
> | Thanks,
> | --
> | Steve Loper
> | Amadeus Consulting
> |
> |
> | "Steven Cheng[MSFT]" wrote:
> |
> | > Thanks for Phillip's inputs.
> | >
> | > Hi Steve,
> | >
> | > I agree with Phillip, the ASP.NET 2.0 by default will enable valiation
> to
> | > the clientside postback script and the submit form fields, it ensure
> that
> | > all the post back script and form fields are generated by the Page's
> script
> | > interface (Page.ClientScripts.xxxx) or the Page's Control
> structure.....
> | >
> | > So I think your custom webcontrol should be a Rendering control(put the
> | > html output code in Render method) rather than a composite control
> (using
> | > CreateChildControls to construct control structure....) or you've
> manually
> | > output some client scripts, yes?
> | >
> | > If so, my suggestion is try best to use Composite control instead of
> | > rendering control and always use the Page's script interface to
> generate
> | > scirpts....(e.g: ClientScript.GetPostBackEventReference .......) ,
> and
> | > makesure all the HtmlForm's <input ..... > elements are created through
> | > Control instance rather than rendering through Response.Write("<input
> | > .......") ....
> | >
> | > #Creating Custom Web Controls with ASP.NET 2.0
> | >
> http://msdn.microsoft.com/library/en-us/dnvs05/html/custwebcon.asp?frame=tru
> | > e
> | >
> | > Thanks,
> | >
> | > Steven Cheng
> | > Microsoft Online Support
> | >
> | > Get Secure! www.microsoft.com/security
> | > (This posting is provided "AS IS", with no warranties, and confers no
> | > rights.)
> | >
> | >
> | >
> | >
> | >
> |
> |
>
>
.
- Follow-Ups:
- RE: RE: RE: RE: Custom GridView Control – Postback Problems
- From: Steven Cheng[MSFT]
- RE: RE: RE: RE: Custom GridView Control – Postback Problems
- References:
- RE: RE: Custom GridView Control – Postback Problems
- From: Steven Cheng[MSFT]
- RE: RE: Custom GridView Control – Postback Problems
- From: Amadeus Consulting
- RE: RE: RE: Custom GridView Control – Postback Problems
- From: Steven Cheng[MSFT]
- RE: RE: Custom GridView Control – Postback Problems
- Prev by Date: Re: Viewing Composite Controls at Design Time
- Next by Date: Re: Walking thr DataReader
- Previous by thread: RE: RE: RE: Custom GridView Control – Postback Problems
- Next by thread: RE: RE: RE: RE: Custom GridView Control – Postback Problems
- Index(es):
Relevant Pages
|