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

  • Home
  • SEARCH
  • 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 929179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:07:36+00:00 2026-05-15T20:07:36+00:00

How does asp.net parse the GridView? Suppose I have defined both EditItemTemplate and ItemTemplate.

  • 0

How does asp.net parse the GridView? Suppose I have defined both EditItemTemplate and ItemTemplate. It seems that I can’t do any data bound at the loading time to the controls like dropdownlist in the EditItemTemplate.

And is it true that the data will be bound to the controls in the EditItemTemplate when the Edit mode is activated? If not, how to bind all controls at the loading time in C#?

Thanks, this is actually driving me crazy. I can’t find anything about how asp.net execute or evaluate the GridView online.

  • 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-15T20:07:37+00:00Added an answer on May 15, 2026 at 8:07 pm

    You need to bind at when it is put into edit mode. Remember the edit controls do not exist until the it is set to edit mode for a specific row. At that time the controls are available to be bound.

    Normally if you have common lookup type data you want to bind at edit mode, I load it into Cache, Session or ViewState (depending on content and situation) the first time it is needed and then bind it from this ‘cached’ location to save DB calls. I normally implement the OnDataBinding method for each control within the EditItemTemplate that need special binding like a DropDownList.

    In your aspx:

    <EditItemTemplate>
        <asp:DropDownList ID="yourDropDownList" runat="server" 
            OnDataBinding="yourDropDownList_DataBinding"></asp:DropDownList>
    </EditItemTemplate>
    

    Then in your codebehind:

    protected void yourDropDownList_DataBinding(object sender, System.EventArgs e) 
    { 
        DropDownList ddl = (DropDownList)(sender);
        // do you databinding code here
    
        // this is an example
        ddl.DataSource = GetMyDropDownListData();
        ddl.DataBind();
        ddl.SelectedValue = Eval("FieldFromGridData");
    }
    

    I prefer to bind this way as it will localizes the code to specific controls and your don’t have to go looking for them using FindControl on rows etc…

    The yourDropDownList_DataBinding will only fire for the row in edit mode. On your initial bind where nothing is in edit mode, the databinding will not fire but each time you put a row into edit mode it will execute, that is why I say to somehow cache the data you want to bind to a DropDownList the first time you get it.

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

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer ObjectMapper mapper = new ObjectMapper(); MetadataContentBean meta= mapper.readValue(metadatacontent.toString(), MetadataContentBean.class); In… May 16, 2026 at 2:34 pm
  • Editorial Team
    Editorial Team added an answer Perl has always aimed toward practicality, not anything (even close… May 16, 2026 at 2:34 pm
  • Editorial Team
    Editorial Team added an answer The TransactionInterceptor does not contain a setter for the transactionManagerBeanName,… May 16, 2026 at 2:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a new ASP.NET MVC project (my first), and I had been running
I'm building a generic ASP.NET server control that has an attribute used to specify
I'm building ASP.NET MVC2 website that lets users store and analyze data about goods
How does asp.net mvc figures out validation error message for particular field? I got
Does anyone know how to pass a C# ASP.NET array to a JavaScript array?
I am curious to know how does paging work in asp.net? If my query
I have an asp.net application with a background thread. The thread starts when the
I've got an asp.net app that uses forms authentication that denies anonymous users. It's
My current task is an ASP.NET page to display the contents of a data
Is it possible in ASP.NET to take a string containing some HTML and make

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.