get datakey item from checkbox in listview control

I populate listview with checkbox that is populated from database like this........

<asp:ListView ID="List" runat="server" DataKeyNames="Id">
                        <LayoutTemplate>
                            <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                        </LayoutTemplate>
                        <ItemTemplate>
                                <asp:CheckBox ID="ListCheckBoxField" runat="server" Text='<%#Eval("Description") %>' />
                        </ItemTemplate>                                              
                    </asp:ListView>


.......
      for (int i = 0; i < List.Items.Count; i++)
        {
            var item = List.Items[i];
            var checkbox = item.FindControl("checkboxControl") as CheckBox;

            if (checkbox != null && checkbox.Checked)
            {
                //NEED TO GET THE DATAKEY VALUE FOR THE TEXTBOX
            }
        }  

...

I need to get each datakey value of the checkbox


mugseyAsked:
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.

Anurag ThakurTechnical ManagerCommented:
--->>> //NEED TO GET THE DATAKEY VALUE FOR THE TEXTBOX
what text box you are talking about
0
mugseyAuthor Commented:
Whoops sorry I mean checkbox!!!!
0
Anurag ThakurTechnical ManagerCommented:
i still dont completely understand your question
i will rephrase and let me know if i am correct or wrong
you want to get the DataKey ID for the row you have selected in the listview so that the underlying data can be updated accordingly
if yes then have a look at the following link sample http://forums.asp.net/p/1294023/2507309.aspx
Ragi
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
mugseyAuthor Commented:
Thanks but it is not updating is it inserting into table

So the listview control containing one checkbox is populated from database.   The database table has ID, Description so this is how checkboxes are populated.

If a checkbox is checked I want to get the underlying Primary Key of the checkbox as it is populated from the database.  



            var item = List.Items[i];
            var checkbox = item.FindControl("checkboxControl") as CheckBox;

            if (checkbox != null && checkbox.Checked)
            {
               
            }

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
.NET Programming

From novice to tech pro — start learning today.