Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Binding the header text of a GridView column?

Reply
Thread Tools

Binding the header text of a GridView column?

 
 
Hans Merkl
Guest
Posts: n/a
 
      11-09-2005
Hi,

I was wondering if it's possible to bind the header text of a GridView
column to a method of an object I have. At the moment I am setting the
header texts in Page_Load but I was wondering if I can do with databinding.

thanks

Hans Merkl
 
Reply With Quote
 
 
 
 
=?Utf-8?B?dGlta2xpbmc=?=
Guest
Posts: n/a
 
      11-10-2005
Hans,

If you convert the column into a TemplateColumn, you can specify a
HeaderTemplate where you can put any binding code you want. If your object
isn't public or protected, expose a public or protected property of the page
code behind that returns the results of the method call.

Tim

"Hans Merkl" wrote:

> Hi,
>
> I was wondering if it's possible to bind the header text of a GridView
> column to a method of an object I have. At the moment I am setting the
> header texts in Page_Load but I was wondering if I can do with databinding.
>
> thanks
>
> Hans Merkl
>

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      11-10-2005
Hi Hans,

I think Hans's suggestion on using TemplateField is reasonable. The
build-in fields can not allow inline databinding expression, so we have to
utitlize the templateField which can allow define inline html template for
Header and other Item...

If there're any other questions, please feel free to post here.

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: Binding the header text of a GridView column?
| thread-index: AcXljgQYg2NmbV8jRPykLS8iuiWXXQ==
| X-WBNR-Posting-Host: 70.59.48.45
| From: "=?Utf-8?B?dGlta2xpbmc=?=" <(E-Mail Removed)>
| References: <11pfefdu1j392$.1vih2zxswxcot$(E-Mail Removed)>
| Subject: RE: Binding the header text of a GridView column?
| Date: Wed, 9 Nov 2005 16:30:56 -0800
| Lines: 21
| Message-ID: <(E-Mail Removed)>
| 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
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:356877
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hans,
|
| If you convert the column into a TemplateColumn, you can specify a
| HeaderTemplate where you can put any binding code you want. If your
object
| isn't public or protected, expose a public or protected property of the
page
| code behind that returns the results of the method call.
|
| Tim
|
| "Hans Merkl" wrote:
|
| > Hi,
| >
| > I was wondering if it's possible to bind the header text of a GridView
| > column to a method of an object I have. At the moment I am setting the
| > header texts in Page_Load but I was wondering if I can do with
databinding.
| >
| > thanks
| >
| > Hans Merkl
| >
|

 
Reply With Quote
 
Hans Merkl
Guest
Posts: n/a
 
      11-10-2005
Tim,

This works. Thanks a lot.

Hans


> Hans,
>
> If you convert the column into a TemplateColumn, you can specify a
> HeaderTemplate where you can put any binding code you want. If your object
> isn't public or protected, expose a public or protected property of the page
> code behind that returns the results of the method call.
>
> Tim
>
> "Hans Merkl" wrote:
>
>> Hi,
>>
>> I was wondering if it's possible to bind the header text of a GridView
>> column to a method of an object I have. At the moment I am setting the
>> header texts in Page_Load but I was wondering if I can do with databinding.
>>
>> thanks
>>
>> Hans Merkl
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line break in GridView Header Text sck10 ASP .Net 3 12-15-2010 01:04 PM
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
changing the gridview header text fredd00 ASP .Net 8 03-09-2007 08:48 PM
GridView binding - how to stop initial binding Amit ASP .Net 6 10-24-2006 08:06 AM
Image in header column (not replacing column header text) hansiman ASP .Net Datagrid Control 3 02-07-2004 12:17 AM



Advertisments