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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:35:50+00:00 2026-05-13T11:35:50+00:00

I have a list view with a label that shows Step #x, another label

  • 0

I have a list view with a label that shows “Step #x”, another label with the instructions, and then 2 linkbuttons for editing or deleting. At the footer of the ListView is another button “Add New Step” which opens up an empty TextBox and two buttons to save and cancel. I would also like it to increment the label, but I can seem to find the control in the code behind to change it’s text. How do I do this?

Here’s the asp markup:

<asp:ListView ID="lvSteps" runat="server" DataSourceID="ldsProcessStep" DataKeyNames="ID" InsertItemPosition="None">
    <LayoutTemplate>
        <div><asp:PlaceHolder ID="itemPlaceholder" runat="server" /></div>
        <asp:Button ID="btnAddNewStep" runat="server" Text="Add New Step" OnClick="btnAddNewStep_Click" />
    </LayoutTemplate>
    <ItemTemplate>
        <table width="100%">
            <tr>
                <td>
                    <asp:label runat="server" Text='<%# Eval( "StepNumber", "Step #{0}" ) %>' Width="75px" style="font-size:medium; font-weight:bold;" />
                </td>
                <td>
                    <div style="text-align:left; width:350px;">
                        <asp:label runat="server" Text='<% #( Eval("Instruction") ) %>' style="font-size:85%;" />
                    </div>
                </td>
                <td>
                    <div style="width:50px;">
                        <div><asp:LinkButton Text="Edit" runat="server" CommandName="Edit" style="font-size:75%;" /></div>
                        <div style="margin-top:5px;"><asp:LinkButton Text="Delete" runat="server" style="font-size:75%;" OnClientClick='<%# CreateConfirmation( Eval("StepNumber") ) %>' /></div>
                    </div>
                </td>
            </tr>
        </table>
        <hr style="width:90%; margin-left:20px;" />
    </ItemTemplate>
    <InsertItemTemplate>
        <table width="100%">
            <tr>
                <td>
                    <asp:Label ID="lblNewStepNumber" runat="server" Width="75px" Text="????" style="font-size:medium; font-weight:bold;" />
                </td>
                <td>
                    <div style="text-align:left; width:350px;">
                        <asp:TextBox ID="txtInstruction" runat="server" TextMode="MultiLine" Rows="3" Width="100%" Text='<%# Bind("Instruction") %>' style="font-size:85%;" />
                    </div>
                </td>
                <td>
                    <div style="width:50px;">
                        <div><asp:LinkButton ID="btnInsert" Text="Save" runat="server" CommandName="Insert" style="font-size:75%;" /></div>
                        <div style="margin-top:5px;"><asp:LinkButton ID="lnkCancelInsert" Text="Cancel" runat="server" CommandName="Cancel" OnClick="btnCancelInsert_Click" style="font-size:75%;" /></div>
                    </div>
                </td>
            </tr>
        </table>
    </InsertItemTemplate>
</asp:ListView>

And some attempted code:

public void btnAddNewStep_Click( object sender, EventArgs e )
{
    lvSteps.InsertItemPosition = InsertItemPosition.LastItem;
    lvSteps.FindControl( "btnAddNewStep" ).Visible = false;

    //Cannot find control

    //lvSteps.FindControl( "lblNewStepNumber" ).Text = "doesn't work"

    //Label lbl = (Label)lvSteps.FindControl( "lblNewStepNumber" );
    //lbl.Text = "Doesn't work"'
}
  • 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-13T11:35:50+00:00Added an answer on May 13, 2026 at 11:35 am

    I believe lvSteps has a reference to InsertItem (as in lv.InsertItem.FindControl(“”)), which you can use to find controls in the insert template. For lvSteps.FindControl finds controls created in the layout template. I think ItemDataBound or ItemCreated may also fire for the insert item, but I’m not 100% sure about that.

    Property definition is available here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.insertitemtemplate.aspx

    HTH.

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

Sidebar

Related Questions

We have created a new List View Style that shows thumbnails from a picture
I have a list view that is periodically updated (every 60 seconds). It was
I have a view that has a list of jobs in it, with data
I have a list view control which at the moment only allows one item
I currently have a list view which has several rows of data and I
I have a databound list view and can set all the column widths manually
How to implement CEditListCtrl?. List control with edit capabality (Report/Grid view). I have a
I have a ListView in WPF that is databound to a basic table that
I have a viewmodel class for a create view that consists of 2 properties
I have a ListView on a page that uses a object data source. I

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.