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 7839845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:34:05+00:00 2026-06-02T15:34:05+00:00

I have a ListView in an ASP.NET web application. When a user clicks the

  • 0

I have a ListView in an ASP.NET web application. When a user clicks the edit button, I want textfields to pop up that are dependent on certain values of the item. However, I can’t seem to find any controls inside of my ListView1_ItemEditing() function.

I have read the Microsoft documentation and various help threads on the internet, but their suggestions do not appear to work for me. This is generally what I see:

ListViewItem item = ProductsListView.Items[e.NewEditIndex];
Label dateLabel = (Label)item.FindControl("DiscontinuedDateLabel");

For the sake of simplicity I just want to be able to select a label in ListView1_ItemEditing(). This is the code in ListView1_ItemEditing():

protected void ListView1_ItemEditing(Object sender, ListViewEditEventArgs e)
{
    DataBind(); //not sure if this does anything
    ListViewItem item = ListView1.Items[e.NewEditIndex];
    Label debugLabel = (Label)item.FindControl("label_editing");
    debugLabel.Text = "Works";
}

Here is the ASP

<EditItemTemplate>
   <asp:Label ID="label_editing" runat="server" Text="hello world"></asp:Label>
</EditItemTemplate>

When debugging, item and debugLabel are both NULL.

UPDATE: I resolved this issue by moving my logic to ItemDataBound and then checking if my tr (containing textboxes) was in that particular data item. Code below:

protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            Control tr_verizon = e.Item.FindControl("tr_verizonEdit");
            Control tr_att = e.Item.FindControl("tr_attEdit");
            if (tr_verizon != null)
            {
                //Control tb_meid = e.Item.FindControl("TextBox_Meid");
                Label lbl_carrierId = (Label)e.Item.FindControl("lbl_carrierId");
                if (lbl_carrierId == null)
                {
                    Message.Text = "lbl_carrierId is null!";
                }
                else if (lbl_carrierId.Text.Equals(""))
                {
                    Message.Text = "lbl_carrierId is empty!";
                }
                else
                {
                    string recordId = lbl_carrierId.Text;

                    if (tr_verizon != null && tr_att != null)
                    {
                        if (lbl_carrierId.Text.Equals("1"))
                        {
                            tr_verizon.Visible = false;
                            tr_att.Visible = true;
                        }
                        else
                        {
                            tr_verizon.Visible = true;
                            tr_att.Visible = false;
                        }
                    }
                }
            }
        }
    }
  • 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-06-02T15:34:07+00:00Added an answer on June 2, 2026 at 3:34 pm

    The ItemEditing event is raised when an item’s Edit button is clicked, but before the ListView item is put in edit mode. Therefore controls in EditItemTemplate are not available at this time.

    More Info and example

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

Sidebar

Related Questions

I'm working on a ASP.NET web forms application. I have a four-column listview, bound
ASP.NET application, VB or C# doesn't matter. I have Listview which databound to Dataset
actually, i'm developing a web template using ASP.NET and C#. i have a listview
I have trouble with editing listview (asp.net 3.5 server control). I want to accomplish
i have develop a small asp.net web application in this i have a in
I have a ListView in ASP.NET where one column consists checkBoxes. I want the
In my asp.net page I have a listview that has a datapager defined in
I have coding like this in my asp.net web form application [asp.net 4.0] <ul
I have a asp.net Listview. I want to be able to get the Position
I have an asp:ListView control on an ASP.NET page. It is bound to an

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.