views:

1056

answers:

2

I have a aspxgridview control from DevXpress. Is there a way to dynamically specify the column headers in the code file and not in the aspx file?

This is what I have right now (in the aspx/html file):

    <dxwgv:ASPxGridView ID="grid" runat="server" OnInit ="grid_Init">
         <Columns>
            <dxwgv:GridViewDataTextColumn Caption="CLERK" FieldName="CLERK" VisibleIndex="1">
            </dxwgv:GridViewDataTextColumn>
            <dxwgv:GridViewDataTextColumn Caption="SALE" FieldName="SALE" VisibleIndex="2">
            </dxwgv:GridViewDataTextColumn>
        </Columns>
    </dxwgv:ASPxGridView>

What I want to do is something like this:

if lang = english
  grid.column.header(2, SALE)
elsif lang = french
  grid.column.header(2, vente)
+1  A: 

Yes you would write something like this.

grid.columns(8).headertext = "Sale"

you have to go by the column's index with the first column being index of 0.

Eric
At least for my version of the devxpress grid, I had to do this: grid.columns(8).caption = "Sale"
Mike
A: 

Use the Resources, I think that better:

<dxwgv:GridViewDataTextColumn Caption="<%$ Resources:CultureHeaders, SomeFieldHeader %>">
</dxwgv:GridViewDataTextColumn>
Jo Asakura