How to find which button was clicked in a repeater itemtemplate and find the value of textbox

A

AlecL

Hi All,

I am trying to capture the value of a textbox as a result of a button
click event in a repeater, but it can't find the textbox.

Here is what I am trying to do in the code for the click event:

Dim prodkey As String = CType(FindControl("txtProductkey"),
TextBox).Text.ToString()
Response.Redirect("store_shoppingcart.aspx?pkey=" & prodkey)

But it says that the textbox is not instantiated. Now I understand
that I can get the row where that button is clicked but when I look
for e.item that option is not available just the items collection is
available.

!!!!!!!!How do I find Out which button was clicked and how do I get
the corresponding textbox value!!!!!!!!!!!!!!

Please help!!!!

Al
 
G

Guest

The "sender" object parameter of the Click event handler will give you the
button that was clicked, and you can look at it's ID property to find your
way back to which row of the Repeater the clicked button is in.
Then you can use that information to find the corresponding textbox.
That is, assuming I read your intent correctly...
Peter
 
A

AlecL

The "sender" object parameter of the Click event handler will give you the
button that was clicked, and you can look at it's ID property to find your
way back to which row of the Repeater the clicked button is in.
Then you can use that information to find the corresponding textbox.
That is, assuming I read your intent correctly...
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net












- Show quoted text -

Thanks, Peter!

I looked at the sender object and it does not have an ID property.
Will you have an example or is there another property that will give
me this info?

Any help would be appreciated.

Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top