PC Review


Reply
Thread Tools Rate Thread

how to add programmatically a boundfield to a gridview?

 
 
michel
Guest
Posts: n/a
 
      17th Feb 2007
Hi,

I want to add programmatically a boundfield to a gridview:

<asp:GridView ID="GridView1" runat="server">
<Columns>
</Columns>
.....
</asp:GridView>

code-behind:
-----------------
Dim bf As new BoundField
GridView1.Controls.Add(bf)

this gives the error:
"Value of type 'System.Web.UI.WebControls.BoundField' cannot be converted to
'System.Web.UI.Control"

Thanks for help
Michel


 
Reply With Quote
 
 
 
 
michel
Guest
Posts: n/a
 
      17th Feb 2007
i found it:

Dim bf As BoundField
bf = New BoundField
bf.DataField = "fld"
GridView1.Columns.Add(bf)


"michel" <mm@mmm> schreef in bericht
news:(E-Mail Removed)...
> Hi,
>
> I want to add programmatically a boundfield to a gridview:
>
> <asp:GridView ID="GridView1" runat="server">
> <Columns>
> </Columns>
> ....
> </asp:GridView>
>
> code-behind:
> -----------------
> Dim bf As new BoundField
> GridView1.Controls.Add(bf)
>
> this gives the error:
> "Value of type 'System.Web.UI.WebControls.BoundField' cannot be converted
> to 'System.Web.UI.Control"
>
> Thanks for help
> Michel
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Getting BoundField value in GridView problem David C Microsoft ASP .NET 2 14th Jan 2008 02:50 PM
how to add programmatically a boundfield to a gridview? michel Microsoft ASP .NET 1 17th Feb 2007 04:52 PM
Dynamic BoundField in a gridview Chicagoboy27 Microsoft ASP .NET 1 2nd Oct 2006 10:49 PM
how to add a boundfield programmatically? Cas Microsoft VB .NET 0 20th Aug 2006 10:58 PM
Adding a BoundField to a GridView John Smith Microsoft Dot NET 0 2nd Jul 2005 02:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 AM.