socialMatrix
socialMatrix

Reputation: 1443

getting a value from ListView in C# asp.net

I have am generating a listView that looks like this

enter image description here

Now, on the click of the "Add To Briefcase" button, I need to go though the each item and email the once where user has entered quantity.

I saw I can do something like this

 foreach (var item in productFormsView.Items)
 {
     var somevalue = ((Form)item.DataItem).Quantity;
 }

However, item.DataItem is returning null as below. How do I get the text from "QUANTITY" textboxes?

enter image description here

Upvotes: 1

Views: 1064

Answers (1)

peter
peter

Reputation: 124

when you click the button. there was a new request come to your web server.the productFormsView will be init,so the item is null. you can save the quantity data in some hidden filed by javascript when you click the button, and get the quantity from Request.Form["xxx"]

Upvotes: 1

Related Questions