473,757 Members | 3,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to delete a hidden input's value in code-behind

Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.

I have tried using Request.Params. Remove("HiddenF ield"), Request.Form.Re move("HiddenFie ld"), Request.Form.Cl ear(), ect, but all are read-only. I have tried using RegisterHiddenF ield("HiddenFie ld","") but this is not killing the HiddenField's value. Is it possible to delete this client side control from the server? Are there any crafty javascript commands I am overlooking to accomplish this?

Thanks,

Alex
Nov 18 '05 #1
4 5997
Alex,

The refresh button will always repeat previous postback exactly as it was no matter how you modify the page. That is built-in behavior of the browser and you can't change it. You can fight it on server side by implementing a sort of algorithm for detecting repeating postbacks.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:uI******** ******@TK2MSFTN GP09.phx.gbl...
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.

I have tried using Request.Params. Remove("HiddenF ield"), Request.Form.Re move("HiddenFie ld"), Request.Form.Cl ear(), ect, but all are read-only. I have tried using RegisterHiddenF ield("HiddenFie ld","") but this is not killing the HiddenField's value. Is it possible to delete this client side control from the server? Are there any crafty javascript commands I am overlooking to accomplish this?

Thanks,

Alex
Nov 18 '05 #2
Thanks. Now how can I detect repeating post backs?

Alex
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:O%******** ********@TK2MSF TNGP11.phx.gbl. ..
Alex,

The refresh button will always repeat previous postback exactly as it was no matter how you modify the page. That is built-in behavior of the browser and you can't change it. You can fight it on server side by implementing a sort of algorithm for detecting repeating postbacks.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:uI******** ******@TK2MSFTN GP09.phx.gbl...
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.

I have tried using Request.Params. Remove("HiddenF ield"), Request.Form.Re move("HiddenFie ld"), Request.Form.Cl ear(), ect, but all are read-only. I have tried using RegisterHiddenF ield("HiddenFie ld","") but this is not killing the HiddenField's value. Is it possible to delete this client side control from the server? Are there any crafty javascript commands I am overlooking to accomplish this?

Thanks,

Alex
Nov 18 '05 #3
Use something unique, that can't be posted back again, and save it on server side. If it comes again, that must be from the refresh button. You can use a timestamp if you don't have anything else unique on the page.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks. Now how can I detect repeating post backs?

Alex
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:O%******** ********@TK2MSF TNGP11.phx.gbl. ..
Alex,

The refresh button will always repeat previous postback exactly as it was no matter how you modify the page. That is built-in behavior of the browser and you can't change it. You can fight it on server side by implementing a sort of algorithm for detecting repeating postbacks.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:uI******** ******@TK2MSFTN GP09.phx.gbl...
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.

I have tried using Request.Params. Remove("HiddenF ield"), Request.Form.Re move("HiddenFie ld"), Request.Form.Cl ear(), ect, but all are read-only. I have tried using RegisterHiddenF ield("HiddenFie ld","") but this is not killing the HiddenField's value. Is it possible to delete this client side control from the server? Are there any crafty javascript commands I am overlooking to accomplish this?

Thanks,

Alex
Nov 18 '05 #4
Eliyahu,

Thanks for the help. This will work for me. Here's what I have implemented.

In my function which uses the hidden input's value, I create a session variable. On my page load, I test this session variable to be null, or something. Since I only want to make changes if the hidden input's value is different than the last time I changed, I can perform my logic here. On a refresh, the session variable will be the same as the hidden input value, so I can disregard it.

Problem solved, thanks!

Alex
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:eR******** ******@TK2MSFTN GP11.phx.gbl...
Use something unique, that can't be posted back again, and save it on server side. If it comes again, that must be from the refresh button. You can use a timestamp if you don't have anything else unique on the page.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Thanks. Now how can I detect repeating post backs?

Alex
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:O%******** ********@TK2MSF TNGP11.phx.gbl. ..
Alex,

The refresh button will always repeat previous postback exactly as it was no matter how you modify the page. That is built-in behavior of the browser and you can't change it. You can fight it on server side by implementing a sort of algorithm for detecting repeating postbacks.

Eliyahu

"Alex" <Al**@donotemai lme.com> wrote in message news:uI******** ******@TK2MSFTN GP09.phx.gbl...
Is there any way to delete the value of a html hidden input field from code-behind? I use an html hidden input to store an array of data. I collect this data using Request.Form or Request.Params. After I use it, I want to force the deletion of it, so a user cannot hit their refresh button on their browser and trigger the same events that just occurred.

I have tried using Request.Params. Remove("HiddenF ield"), Request.Form.Re move("HiddenFie ld"), Request.Form.Cl ear(), ect, but all are read-only. I have tried using RegisterHiddenF ield("HiddenFie ld","") but this is not killing the HiddenField's value. Is it possible to delete this client side control from the server? Are there any crafty javascript commands I am overlooking to accomplish this?

Thanks,

Alex
Nov 18 '05 #5

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

Similar topics

3
2895
by: Boefje | last post by:
The variable contains: delete from divisies where divisieid='1c' After posting it contains: delete from divisies where divisieid= So the part '1c' is magically lost! How is that possible? This is more or less the code in my form: $sqldel = "delete from divisies where divisieid='1c' "; echo"<form action=".$_SERVER." method='post' >\n"; echo"<input class='serred' type=submit value='Verwijderen'
0
1237
by: TNGgroup | last post by:
Hi, I have a dynamic list box with all my records. Whan selecting a value in this box I want to be able to delete the value. but no matter what my selection is, He always deleting the first record. ?? This is my code: <form action="<%=MM_editAction%>" method="POST" name="form_remove" class="content"d="form_remove">
2
3096
by: Les Juby | last post by:
I've used a simple javascript for some time (no entries required up in the <head> tag) that asks for a confirmation before deleting. ie. <a href="/delete.asp?which=345 %>" onclick="javascript:return confirm('Are you ABSOLUTELY SURE you want to DELETE this record ?')">Delete record</a> On several sites I use short form constructs to generate a more recognizable button, and would like to use a simple script such as
17
1751
by: mpar612 | last post by:
Hi everyone, I appreciate all of your help with me and the problems I have been having. I'm new to PHP and MySQL and I'm having some problems getting this script to work. I can't get this to work and I don't understand why. I don't get an error or anything, it almost seems like the page refreshes. I went to the phpmyadmin and the row is still in the database. The $_GET parts work perfectly in another script and the SQL statement...
1
7834
by: bazubwabo | last post by:
hi everybody, there is someone who can help me to find out how to create a delete button .Indeed,I have then 2 buttons, one for insert(works well),second one is therefore for to delete. You can check out below the code: ?> <?php if(isset($_POST)){ $query="DELETE FROM SCANNER WHERE SCANNER.scanNo ='".$scanNo."'"; $result=mysql_query($query); }
3
3426
by: bluez | last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record. Filename : search_student.php <?php include("../user_access/user_access_control.php"); include("../Database/database.php"); $searchStudentControl = new Access_user;
4
2310
nomad
by: nomad | last post by:
Hello Everyone: I'm working on a project for a client in which they want to add and delete events for a selected day on a calendar. I have built the calendar and added the events, but I'm having troubles deleting the event. I thought I could use the same code for adding the event and change some of the code. I get this error when doing so You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version...
0
1990
by: Slickuser | last post by:
From my PHP page: Grab all data from the database. Go through a loop to generate the HTML. Client side: From the Color drop menu list, if a user change the value. It will grab that value & update to the database based on the hidden ID. DELETE ALL will delete everything the databse.
107
11338
by: bonneylake | last post by:
Hey Everyone, Well for the last few days i been trying to figure out how to delete attachments and download attachments to my computer. The deleting is sort of working and i don't know where to begin on downloading. Right now with the deleting it will delete from the attachments folder on the server but it does not delete from the database an was wondering if someone could explain what i am doing wrong on deleting attachments and how i could...
29
5344
by: shivasusan | last post by:
Hi! I can add rows with inputs to my HTML table dynamically using DOM, but I cannot remove selected rows. In fact, every row contains a Delete button. So, user selects the rows to remove, clicks the delete button selected row wants to delete. My problem is(If i delete the first row, its say undefined and change the value is 0) pls check my program. <%pathdefiner = "../"%> <!--#include file="../connection/connector.asp" -->...
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
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
10069
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
9884
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
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
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...
0
6556
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();...
1
3828
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
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.