How to use a ListView inside a ListView

Hi,

  I have a ListView inside a ListView and I need to processe the inner ListView data. This is the code:

    <asp:ListView ID="ListView1" runat="server" OnItemDataBound="ItemDataBound">
        <ItemTemplate>
                <asp:ListView ID="lvItems" runat="server" OnItemEditing="ItemEditing">
                    <LayoutTemplate>
                        <div id="itemPlaceholder" runat="server" style="float: left; width: 100%">
                        </div>
                    </LayoutTemplate>
                    <ItemTemplate>
                                <asp:ImageButton ID="btnEdit" runat="server" CommandName="Edit" ImageUrl="~/Imagens/btnEditar.png"
                                    ToolTip='<%# Eval("key") %>' />&nbsp;

  When I click the button (btnEdit) I need to get the corresponding info. I gues it should happen at ItemEditing but in the code lvItems is not visible because it is part of ListView1. How do I get this data? I need to read KEY value.

  Thanks,
  Marco Castro
MarcoCastroAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Navneet.Net Full Stack DeveloperCommented:
0
MarcoCastroAuthor Commented:
Hi,

  Your example shows to to populate the ListView. This I have already done.

  What I need is to process when I click the btnEdit button. I need to read the KEY data from this button that is part of a ListView that is part of another ListView.

  Thanks,
  Marco Castro
0
MarcoCastroAuthor Commented:
I got the solution. In ItemEditing of lvItems

ImageButton ib = (sender as ListView).Items[e.NewEditIndex].FindControl("btnEdit") as ImageButton;

brings the desired info.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarcoCastroAuthor Commented:
In Microsoft documentation I find the solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.