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.
|