473,385 Members | 1,752 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,385 software developers and data experts.

Hidden Field Value_Changed Event Not Firing

35
the ValueHiddenField_ValueChanged event is not firing
please help me how to trigger my value changed event so that Message.Text that is "The value of the HiddenField control is " + ValueHiddenField.Value
is displayed in my web page

Expand|Select|Wrap|Line Numbers
  1. <script runat="server">
  2. void ValueHiddenField_ValueChanged (Object sender, EventArgs e)
  3.   {
  4.  
  5.     // Display the value of the HiddenField control.
  6.     Message.Text = "The value of the HiddenField control is " + ValueHiddenField.Value + ".";
  7.  
  8.   }
  9. </script>
  10.  
  11. <html xmlns="http://www.w3.org/1999/xhtml" >
  12. <head runat="server">
  13.     <title>Untitled Page</title>
  14. </head>
  15. <body>
  16.     <form id="form1" runat="server">
  17.     <div>
  18.      <h3>HiddenField Example</h3>
  19.  
  20.             Please enter a value and click the submit button.<br/>
  21.  
  22.             <asp:Textbox id="ValueTextBox"
  23.               runat="server"/>
  24.  
  25.             <br/>  
  26.  
  27.             <input type="submit" name="SubmitButton"
  28.              value="Submit"
  29.              onclick="PageLoad()" />
  30.  
  31.             <br/>
  32.  
  33.             <asp:label id="Message" runat="server"/>&nbsp;
  34.  
  35.     </div>
  36.  
  37.             <asp:hiddenfield id="ValueHiddenField"
  38.               onvaluechanged="ValueHiddenField_ValueChanged"
  39.               value="" 
  40.               runat="server"/>
  41.     </form>
  42. </body>
  43. </html>
  44.  
  45. <script type="text/javascript">
  46.   <!--
  47.   function PageLoad()
  48.   {
  49.     // Set the value of the HiddenField control with the
  50.     // value from the TextBox.
  51.     Form1.ValueHiddenField.value = Form1.ValueTextBox.value;
  52.  
  53.   }
  54.   -->
  55. </script>
Aug 22 '08 #1
4 4367
cloud255
427 Expert 256MB
Well, according to the MSDN, the event is only raised if the value changes between postbacks...
Aug 22 '08 #2
Plater
7,872 Expert 4TB
Yes, the events only occur durring a postback.
Also, if it's a hidden field, how is it being changed?
Aug 22 '08 #3
femina
35
so if the Value_Changed event triggers between post backs
lets assume textbox value is "femina" for the first time i click a button and if i change my text box value the next time say "fayaz" and then i click my button.
Now will the Value_Changed event be triggered since i have assigned my hiddenfield value with the textbox value each time before submitting the button
Expand|Select|Wrap|Line Numbers
  1. void ValueHiddenField_ValueChanged (Object sender, EventArgs e)
  2.   {
  3.  
  4.     // Display the value of the HiddenField control.
  5.    Label1.Text += "The value of the HiddenField control is " + HiddenField1.Value + ".";
  6.   }
  7.  
so will the label text be modified in the web page
please clear my doubts
Aug 25 '08 #4
Plater
7,872 Expert 4TB
Changing the value in code behind would not trigger the Value_changed event. However, since you're already IN the code at that point, why not just call the function from code anyway?
Aug 25 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Galina | last post by:
Hello I have an application in MS Access 2000. I have a form, which includes a subform. The subform is based on a table, but locked for any editing. There is Edit button. When clicked, it starts a...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
2
by: Rodusa | last post by:
I have a hidden field inside one datagrid which I can't get to make it keep its state after a postback event. Look field: <input type="hidden" id="TxtHiddenItem_id" name="TxtHiddenItem_id"...
4
by: Woody Splawn | last post by:
I have a grid with, lets say, 3 fields in it, Debit, Credit and Comments, in that order. When the user moves to the debit field, if he enters data in it, I would like for the cursor to skip past...
4
by: PJ6 | last post by:
From a control's onkeypress the below javascript snippet is executed. I am attmpting to set the value of a hidden field... I believe I'd be able to get the contents of the hidden field by using...
4
by: Joe | last post by:
Hello All: I have two webforms (WebForm1.aspx and WebForm2.aspx) that inherit from a base class called BasePage.aspx. BasePage.aspx has no user interface but inherits System.Web.UI.Page...
3
by: ThunderMusic | last post by:
Hi, I have a custom control that draws many thing on the screen including a hidden field. This hidden field's value is modified through client code. What I want to do is the following : When there...
8
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView and a hidden field : <asp:TemplateField Visible=false > <ItemTemplate > <asp:HiddenField Value="<%#Eval("isActive")%>" id="hidIsActive" runat=server /> </ItemTemplate>...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.