473,320 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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?
Nov 18 '05 #1
2 3884
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

"Kevin" <ke***@0type.com> wrote in message
news:74**************************@posting.google.c om...
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?

Nov 18 '05 #2
thanks - worked like a charm.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Randell D. | last post by:
Folks, I am working on a contact db using PHP and MySQL. My results so far outputs a slimed down version of records to the browser. I would like to implement a method whereby the user can...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
6
by: charlie_M | last post by:
I figured out via various help from this forum... EXAMPLE: onClick="document.forms.MYBUTTON.value='SIMPLE';document.forms.submit()" In my CGI I see "MYBUTTON" = "SIMPLE" and this works...
5
by: cmc_dermo | last post by:
I have a form that has a select list. A user chooses a value and the page refreshes showing the selected value in the dropdown box. So I want to use Javascript to get the selected query from...
0
by: Kannan.M.R | last post by:
Hi, I have a problem in assigning the selected value in the dropdown to a hidden control. It goes like this. I have a repeater control. In the repeater control’s item template, I have a...
0
by: datakix | last post by:
After 16 hours of frustration, I've managed to solve this problem for a project I'm working on. The 'trick' is set EnableViewState="False" for the asp:textbox inside the Repeater control. The...
3
by: Jeff | last post by:
Hey ASP.NET 2.0 Below you see the code I'm having problem with. In the Open_Message event/method I want to get the value of the HiddenField at the row in the repeater control I clicked.... my...
7
by: turtle | last post by:
I want to find out the max value of a field on a report if the field is not hidden. I have formatting on the report and if the field doesn't meet a certain criteria then it is hidden. I want to...
1
by: mark | last post by:
Forgive me if this seems like a stupid question but I need help... I'm trying to do a simple online form that emails me the results from a few fields. Here is the code: <form...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.