Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Converting BoundFields from tags to code

Reply
Thread Tools

Converting BoundFields from tags to code

 
 
Pete
Guest
Posts: n/a
 
      09-17-2007
Hi - In DetailsView I want to convert the bound <Fields> from tags to
code so the fields can be picked up from the schema. I tried
converting:
<asp:BoundField ReadOnly="True" HeaderText="CustomerID"
DataField="CustomerID" SortExpression="CustomerID"></asp:BoundField>
by using:
DetailsView1.Fields.Add(New BoundField)
DetailsView1.Fields(0).HeaderText = "CustomerID"
DetailsView1.Fields(0).SortExpression = "CustomerID"
but I that way can't set the BoundField's DataField or its ReadOnly
value. Help on how to convert to code would be very much appreciated.
-Pete

 
Reply With Quote
 
 
 
 
Pete
Guest
Posts: n/a
 
      09-18-2007
On Sep 17, 4:34 pm, Pete <sign...@msu.edu> wrote:
> Hi - In DetailsView I want to convert the bound <Fields> from tags to
> code so the fields can be picked up from the schema. I tried
> converting:
> <asp:BoundField ReadOnly="True" HeaderText="CustomerID"
> DataField="CustomerID" SortExpression="CustomerID"></asp:BoundField>
> by using:
> DetailsView1.Fields.Add(New BoundField)
> DetailsView1.Fields(0).HeaderText = "CustomerID"
> DetailsView1.Fields(0).SortExpression = "CustomerID"
> but I that way can't set the BoundField's DataField or its ReadOnly
> value. Help on how to convert to code would be very much appreciated.
> -Pete


Addendum: The point in replacing tags with code is so that
"CustomerID," for example, can be replaced by SchemaFields(0) and the
great long list of fields can be replaced by a simple code loop. This
satisfies several dictates of good design. I am surprised that msdn2
seems to be going toward tags-only illustrations rather than both tags
and code.

 
Reply With Quote
 
 
 
 
Pete
Guest
Posts: n/a
 
      09-18-2007
I figured it out. Sorry to have taken up space.

-Pete


 
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
Match width of column heading in row with GridView BoundFields in JB ASP .Net 3 10-21-2009 05:05 PM
Localizing BoundFields helveticus ASP .Net 1 12-02-2008 09:51 PM
Dynamically boundfields aren't really dynamic jonefer ASP .Net Building Controls 0 05-23-2007 07:03 AM
Dynamically Adding Boundfields + Sorting ami ASP .Net 0 04-25-2007 06:15 PM
How do I Email DetailsView BoundFields Christina ASP .Net 0 12-08-2006 09:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57