Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6634289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:54:45+00:00 2026-05-25T22:54:45+00:00

In a web application, how can I find the controls in header, and how

  • 0

In a web application, how can I find the controls in header, and how can I bind the value dynamically to those controls? This is what my gridview looks like…

    ----------------------------------------------
           |     October        |     November    |
    product|                    |                 |
           | self   |  Officer  | self   | officer|
    ----------------------------------------------

This is my gridview header. All are labels, now I want to find the label (october, noverber, self, officer..) how can I bind the data to them dynamically?

I have following code in gridview rowdatabound event.

foreach (GridViewRow gr in grdProducts.Rows)
{
    if (e.Row.RowType == DataControlRowType.Header)
    {
        Label lM = (Label)gr.FindControl("lblMon1");
        lM.Text = month1 + "-" + year1;
        lM = (Label)gr.FindControl("lblMon2");
        lM.Text = month2 + "-" + year2;
        lM = (Label)gr.FindControl("lblMon3");
        lM.Text = month3 + "-" + year3;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:54:45+00:00Added an answer on May 25, 2026 at 10:54 pm

    Check out this example…. @Surya sasidhar

    In Aspx page.. I added below gridview

    <asp:GridView ID="grvGrid" runat="server" AllowPaging="True"   
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID" OnRowDataBound="grvGrid_RowDataBound">  
                <Columns>  
                    <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"   
                        SortExpression="CustomerID" />  
                    <asp:BoundField DataField="CompanyName" HeaderText="CompanyName"   
                        SortExpression="CompanyName" />  
                   <asp:TemplateField>
                        <HeaderTemplate>
                            <asp:Label ID="lblMon1" runat="server"></asp:Label>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblblbl" runat="server"></asp:Label>
                        </ItemTemplate>
                   </asp:TemplateField>
                </Columns>  
            </asp:GridView> 
    

    At code behind page, I added below code…..

      protected void Page_Load(object sender, EventArgs e)
        {
            GetTable();
            grvGrid.DataSource = dstable;
            grvGrid.DataBind();
        }
    
    
    
    protected void grvGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                Label lblnothing = (Label)e.Row.FindControl("lblMon1");
                lblnothing.Text = "November";
            }
    
        }
    
    private void GetTable()
        {
            dstable.Columns.Add("CustomerID", typeof(int));
            dstable.Columns.Add("CompanyName", typeof(string));
            //
            // Here we add five DataRows.
            //
            dstable.Rows.Add(25, "Indocin");
            dstable.Rows.Add(50, "Enebrel");
            dstable.Rows.Add(10, "Hydralazine");
            dstable.Rows.Add(21, "Combivent");
            dstable.Rows.Add(100, "Dilantin");
        }
    

    Here is the result….

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anyone help me.I cant create a new web application.I mean i cant find
Where can I find a MessageBox Control for my ASP.net web application? It has
I can not find a mod_go for deploying Go web applications. Is there any
Is solr a web application that can run on the same instance as a
I have a web application that can load plugins through reflection. It currently uses
As part of a web application users can upload files of data, which generates
I am creating an asp web application that can't use JQuery and uses custom
Say that I've got a web application that can store Persons in a database.
What I need to do is create a web application that can run inside
In a load test of our PHP based web application we can easily reach

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.