473,326 Members | 2,655 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,326 software developers and data experts.

updating a hidden field from OnClick

PJ6
In a page I register a hidden field in the c'tor or OnPreRender like so -

Public Sub New()
Me.RegisterHiddenField("TEST", "")
End Sub

In an inherited control I want to update this hidden field like so -

Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
Me.Attributes.Add("onClick", "document.forms[0]." & _
"TEST.value='" & SomeValue & "';document.forms[0].submit();")
MyBase.OnPreRender(e)
End Sub

For some reason, the field isn't being updated. I'm sure it's something
simple... can anyone lend me a clue?

Thanks,
Paul
Nov 19 '05 #1
1 1167
It probably actually IS... but since you are posting back to the server the
control value is being reset again..
Look at the IsPostBack() to exclude it from being reset again.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"PJ6" wrote:
In a page I register a hidden field in the c'tor or OnPreRender like so -

Public Sub New()
Me.RegisterHiddenField("TEST", "")
End Sub

In an inherited control I want to update this hidden field like so -

Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
Me.Attributes.Add("onClick", "document.forms[0]." & _
"TEST.value='" & SomeValue & "';document.forms[0].submit();")
MyBase.OnPreRender(e)
End Sub

For some reason, the field isn't being updated. I'm sure it's something
simple... can anyone lend me a clue?

Thanks,
Paul

Nov 19 '05 #2

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Lisa | last post by:
I have a search page that displays all data from a table <%For intIndex = 1 To rstPalm.RecordCount%> <tr> <td><font size="2" face="arial"><%=rstPalm("load_id")%></font></td> <td><font size="2"...
1
by: Jim | last post by:
I have a 2 checkboxes and a hidden field..what I want to happen is that you can only click on 1 of these checkboxes at a time and when you check a checkbox it will assign the hidden field...
5
by: Raffi | last post by:
Hi folks, I'm new to JavaScript and need some help. I have a form with a select field. Depending on what is selected in this field, I want to display or not display another select field. For...
2
by: Kevin | last post by:
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"...
2
by: FP | last post by:
I'm displaying a list of messages. Each message can be checkmarked as done or not done. When a user clicks on the checkmark I want the following to happen; - checkbox status is toggled between...
5
by: james.calhoun | last post by:
I feel like this should be really easy... I want a hidden field in a form to have its value defined when someone clicks on a link. So if they click on link "A" the value of the hidden field...
15
by: webstormcomputers | last post by:
I'm trying to update a hidden field with java script and I'm only getting one of the values from my select stament. Here is the code below. <select name="on0"> <option value="25">25 <option...
1
by: cerilocke | last post by:
I have a repeater in which I have a hidden field (input type = hidden), a textbox (asp:TextBox), a checkbox (input type = checkbox) and a label (asp:Label). I have bound all four items to the same...
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
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.