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

  • Thread starter Thread starter AlecL
  • Start date Start date
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
 
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
 
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
 
Back
Top