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 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

Related Questions

Does ASP.NET MVC have anything like the RESTful out-of-the-box features like Ruby on Rails
Does ASP.NET MVC provide a standard validator functionality or do you have to create
Just to preface: I work in a small company that does ASP.NET development and
Does Server Core 2008 support asp.net? I see references online saying that it isn't
When a client makes a web service request, how does asp.net assign an instance
When the page displayed in our CDHtmlDialog does an Asp.Net AJAX UpdatePanel we get
How does the new Microsoft asp.net mvc implementation handle partitioning your application - for
When my ASP.NET page does a postback in IE7, all the CSS is lost.
In ASP.NET MVC, how does the controller pass information between the model and the
Does anyone know much about the Asp.Net webconfig element ? I'm looking at it

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.