gridview objectDataSet BusinessLayer

Discussion in 'ASP .Net Web Controls' started by Richard Roche, Jun 1, 2007.

  1. My business object populates the gridview, but i'm having difficulty
    programatically drilling in and changing the headertext at runtime (I need to
    change the language of the column heading based on the client). In the
    gridview object the column collection is empty, count = 0. Why? Do i need
    to drill into the control object? What is the best approach?

    Any help appreciated.
    --
    Richard
    Richard Roche, Jun 1, 2007
    #1
    1. Advertising

  2. Richard Roche

    Manish Bafna Guest

    Hi,
    you can write a code behind function of the page:
    <Columns>
    <asp:BoundField HeaderText="<%# GetHeaderText() %>"
    DataField="ProductName" SortExpression="ProductName">
    </asp:BoundField>
    </Columns>

    and in the code behind file of your page define a custom function
    GetHeaderText() where you define the logic for displaying/manipulating the
    header text:

    public string GetHeaderText()
    {
    return "Header Text";
    }
    --
    Hope this helps.
    Thanks and Regards.
    Manish Bafna.
    MCP and MCTS.



    "Richard Roche" wrote:

    > My business object populates the gridview, but i'm having difficulty
    > programatically drilling in and changing the headertext at runtime (I need to
    > change the language of the column heading based on the client). In the
    > gridview object the column collection is empty, count = 0. Why? Do i need
    > to drill into the control object? What is the best approach?
    >
    > Any help appreciated.
    > --
    > Richard
    Manish Bafna, Jun 1, 2007
    #2
    1. Advertising

  3. Richard Roche

    Manish Bafna Guest

    Hi,
    please ignore my previous post.It should be like below:
    you can write a code behind function of the page:
    <Columns>
    <asp:TemplateField>
    <HeaderTemplate>
    <asp:Label ID="Label1" runat="server" Text="<%# GetHeaderText()
    %>"</asp:Label>
    </HeaderTemplate>
    </asp:TemplateField>
    </Columns>
    and in the code behind file of your page define a custom function
    GetHeaderText() where you define the logic for displaying/manipulating the
    header text:

    public string GetHeaderText()
    {
    return "Header Text";
    }
    for more details refer
    link:http://www.eggheadcafe.com/community/aspnet/2/10020486/change-the-header-text-in.aspx
    --
    Hope this helps.
    Thanks and Regards.
    Manish Bafna.
    MCP and MCTS.



    "Manish Bafna" wrote:

    > Hi,
    > you can write a code behind function of the page:
    > <Columns>
    > <asp:BoundField HeaderText="<%# GetHeaderText() %>"
    > DataField="ProductName" SortExpression="ProductName">
    > </asp:BoundField>
    > </Columns>
    >
    > and in the code behind file of your page define a custom function
    > GetHeaderText() where you define the logic for displaying/manipulating the
    > header text:
    >
    > public string GetHeaderText()
    > {
    > return "Header Text";
    > }
    > --
    > Hope this helps.
    > Thanks and Regards.
    > Manish Bafna.
    > MCP and MCTS.
    >
    >
    >
    > "Richard Roche" wrote:
    >
    > > My business object populates the gridview, but i'm having difficulty
    > > programatically drilling in and changing the headertext at runtime (I need to
    > > change the language of the column heading based on the client). In the
    > > gridview object the column collection is empty, count = 0. Why? Do i need
    > > to drill into the control object? What is the best approach?
    > >
    > > Any help appreciated.
    > > --
    > > Richard
    Manish Bafna, Jun 1, 2007
    #3
  4. Thanks for the reply. Is there no way to iterate thru the collection? This
    was available with the datagrid in framework 1.1. There are nearly 50
    columns and it would be very easy to write a procedure to change the header
    in logic.
    --
    Richard


    "Manish Bafna" wrote:

    > Hi,
    > please ignore my previous post.It should be like below:
    > you can write a code behind function of the page:
    > <Columns>
    > <asp:TemplateField>
    > <HeaderTemplate>
    > <asp:Label ID="Label1" runat="server" Text="<%# GetHeaderText()
    > %>"</asp:Label>
    > </HeaderTemplate>
    > </asp:TemplateField>
    > </Columns>
    > and in the code behind file of your page define a custom function
    > GetHeaderText() where you define the logic for displaying/manipulating the
    > header text:
    >
    > public string GetHeaderText()
    > {
    > return "Header Text";
    > }
    > for more details refer
    > link:http://www.eggheadcafe.com/community/aspnet/2/10020486/change-the-header-text-in.aspx
    > --
    > Hope this helps.
    > Thanks and Regards.
    > Manish Bafna.
    > MCP and MCTS.
    >
    >
    >
    > "Manish Bafna" wrote:
    >
    > > Hi,
    > > you can write a code behind function of the page:
    > > <Columns>
    > > <asp:BoundField HeaderText="<%# GetHeaderText() %>"
    > > DataField="ProductName" SortExpression="ProductName">
    > > </asp:BoundField>
    > > </Columns>
    > >
    > > and in the code behind file of your page define a custom function
    > > GetHeaderText() where you define the logic for displaying/manipulating the
    > > header text:
    > >
    > > public string GetHeaderText()
    > > {
    > > return "Header Text";
    > > }
    > > --
    > > Hope this helps.
    > > Thanks and Regards.
    > > Manish Bafna.
    > > MCP and MCTS.
    > >
    > >
    > >
    > > "Richard Roche" wrote:
    > >
    > > > My business object populates the gridview, but i'm having difficulty
    > > > programatically drilling in and changing the headertext at runtime (I need to
    > > > change the language of the column heading based on the client). In the
    > > > gridview object the column collection is empty, count = 0. Why? Do i need
    > > > to drill into the control object? What is the best approach?
    > > >
    > > > Any help appreciated.
    > > > --
    > > > Richard
    Richard Roche, Jun 1, 2007
    #4
  5. Richard Roche

    Manish Bafna Guest

    Hi,
    Below link solves your query:
    http://forums.asp.net/p/1116572/1732569.aspx
    --
    Hope this helps.
    Thanks and Regards.
    Manish Bafna.
    MCP and MCTS.



    "Richard Roche" wrote:

    > My business object populates the gridview, but i'm having difficulty
    > programatically drilling in and changing the headertext at runtime (I need to
    > change the language of the column heading based on the client). In the
    > gridview object the column collection is empty, count = 0. Why? Do i need
    > to drill into the control object? What is the best approach?
    >
    > Any help appreciated.
    > --
    > Richard
    Manish Bafna, Jun 1, 2007
    #5
  6. Thanks for taking time to help, that is what i wanted.
    --
    Richard


    "Manish Bafna" wrote:

    > Hi,
    > Below link solves your query:
    > http://forums.asp.net/p/1116572/1732569.aspx
    > --
    > Hope this helps.
    > Thanks and Regards.
    > Manish Bafna.
    > MCP and MCTS.
    >
    >
    >
    > "Richard Roche" wrote:
    >
    > > My business object populates the gridview, but i'm having difficulty
    > > programatically drilling in and changing the headertext at runtime (I need to
    > > change the language of the column heading based on the client). In the
    > > gridview object the column collection is empty, count = 0. Why? Do i need
    > > to drill into the control object? What is the best approach?
    > >
    > > Any help appreciated.
    > > --
    > > Richard
    Richard Roche, Jun 1, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Justin Dutoit
    Replies:
    3
    Views:
    3,501
    =?Utf-8?B?dG9tIHdpc25vd3NraQ==?=
    Oct 7, 2004
  2. Nalaka

    GridView in a GridView

    Nalaka, Nov 11, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    6,603
    Nalaka
    Dec 5, 2005
  3. Replies:
    3
    Views:
    5,108
  4. Carlos Albert

    GridView in a GridView

    Carlos Albert, Dec 5, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    495
    Carlos Albert
    Dec 6, 2005
  5. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,956
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
Loading...

Share This Page