locked
Grid View - localization of header text RRS feed

  • Question

  • User1432027055 posted

    I am converting a aspx page to multilingual. The rest of the page I am able to localize without any problems. The only issue I am facing is how to localize the headertext for the gridview columns. For example how to localize the headertext "Building Number". Please advise what will go in the resource file. Here is my grid view

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
            DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None" Font-Size="Small" Width="100%" Font-Names="tahoma">
            <Columns>    
           
           
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
                    ReadOnly="True" SortExpression="ID" Visible="False" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
             
                <asp:BoundField DataField="BuildingNo" Text="Building Number"SortExpression="BuildingNo"/>

      </Columns>
    </asp:GridView>

    Thursday, May 1, 2008 4:28 PM

Answers

  • User1564875471 posted

    Hi

    firstly , you add resource key to the boundfield as follows:

    <asp:BoundField DataField="BuildingNo" Text="Building Number" SortExpression="BuildingNo" meta:resourcekey="BuildingNoResource" />

    Now , to localize the HeaderText , you need to add a key with name

    BuildingNoResource.HeaderText  and set its value in the file ,

    Simlilarly , if you want to localize the FooterText of this BoundField,

    you need to add BuildingNoResource.FooterText to the page Localization file ,

     

    Hope it helps

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 1, 2008 7:47 PM

All replies

  • User1564875471 posted

    Hi

    firstly , you add resource key to the boundfield as follows:

    <asp:BoundField DataField="BuildingNo" Text="Building Number" SortExpression="BuildingNo" meta:resourcekey="BuildingNoResource" />

    Now , to localize the HeaderText , you need to add a key with name

    BuildingNoResource.HeaderText  and set its value in the file ,

    Simlilarly , if you want to localize the FooterText of this BoundField,

    you need to add BuildingNoResource.FooterText to the page Localization file ,

     

    Hope it helps

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 1, 2008 7:47 PM
  • User1432027055 posted

    Thanks a lot Anas - that worked - I was using Text instead of "HeaderText"[:$]

    Friday, May 2, 2008 11:59 AM
  • User-2018423831 posted

    Hi Anas,

    thank you a lot. I searched on it for hours.

    Best regards

    Kevin

    Thursday, October 29, 2009 5:21 AM