how do I get the value of a post from a hidden field in repeater?

K

Kevin

I've got a problem where I need to know the value of a hidden field
inside a repeater once a button is clicked. Ths code inside my
repeater looks like this:

<input id="conf_num" type="hidden" value=<%#
trim(Container.DataItem("confirm_num"))%> name="conf_num"
runat="server" />

<asp:ImageButton ImageUrl="images/send_conf.gif"
OnClick="ConfSend_Click" runat="server" />

Rendered, it looks like this:

<input name="grid3:_ctl1:conf_num" id="grid3__ctl1_conf_num"
type="hidden" value="551059" />

Obviously, I can get the value if I do something like:

Sub ConfSend_Click
ViewState("conf_num") = Request.form("grid3:_ctl1:conf_num")
End Sub

But this doesn't work because to do this right I can't specify the
exact Request.form 'conf_num' value, since that value needs to be
dynamic based on the button the user clicks on. I've tried
everything, I think. Each row in the repeater has its own button...

What happened to the good old days when a hidden field was a hidden
field. The 'grid3:_ctl1:' the rendered repeater adds on is giving me
major problems.

Any ideas?
 
R

Raterus

Look at the commandname/commandargument properties of the imagebutton, you
can set them to anything you want. Then use the onCommand (not onClick)
event of the imagebutton to catch them on the next page. In your handler
e.CommandName and e.CommandArgument would be from the button you clicked.
Doing this you can avoid all the mess of using hidden fields.

Hope this helps,
--Michael
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top