473,756 Members | 2,996 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("confi rm_num"))%> name="conf_num"
runat="server" />

<asp:ImageButto n ImageUrl="image s/send_conf.gif"
OnClick="ConfSe nd_Click" runat="server" />

Rendered, it looks like this:

<input name="grid3:_ct l1: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("g rid3:_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 3937
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.CommandArgume nt 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.co m> wrote in message
news:74******** *************** ***@posting.goo gle.com...
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("confi rm_num"))%> name="conf_num"
runat="server" />

<asp:ImageButto n ImageUrl="image s/send_conf.gif"
OnClick="ConfSe nd_Click" runat="server" />

Rendered, it looks like this:

<input name="grid3:_ct l1: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("g rid3:_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
4902
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 click on a text link which will then show the full record. I don't want to have hyperlinks with values incorporated in the link (thus, I don't want to have http://www.example.com?abc=1234) - I prefer to use a POST method thus what I would like to do...
16
11501
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 an object... the function is like so: function calc_total() { var x,i,base,margin,total,newmargin,newtotal; base = document.frmKitAmount.txtTotalKitValue.value; margin = document.frmKitAmount.margin.value/100;
6
2749
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 fine.... except that the element MYBUTTON must exist as a hidden field.
5
1885
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 the form. I then want to pass it as a hidden field. So for example the section of the page I'm interested in will look like
0
2149
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 hidden control and a placeholder control. I must generate the required number of dropdowns and the buttons dynamically based on a field value in my dataset. So I do the same in my code behind and add the generated controls to the place holder in the...
0
10547
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 problem is that by default the asp:textbox ViewState is True. This means that the textbox value is automatically preserved between postback (saved in the __VIEWSTATE hidden field and restored during a page postback).
3
6855
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 goal is to get the id (not a control Id, but an id related to a database record) of a row in the repeater control. I don't want to use Get... I've tryed to use e.FindControl in the Open_message event but FindControl isn't available, so I don't...
7
3240
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 get a max of the field for the ones that are not hidden. is this possible? TIA, KO
1
7084
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 action="http://cm1web1/WebSurveyComponents/script/ processform.asp" method="post">
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10014
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.