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

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("HiddenField"), Request.Form.Remove("HiddenField"), Request.Form.Clear(), ect, but all are read-only. I have tried using RegisterHiddenField("HiddenField","") 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 5958
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**@donotemailme.com> wrote in message news:uI**************@TK2MSFTNGP09.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("HiddenField"), Request.Form.Remove("HiddenField"), Request.Form.Clear(), ect, but all are read-only. I have tried using RegisterHiddenField("HiddenField","") 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.com> wrote in message news:O%****************@TK2MSFTNGP11.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**@donotemailme.com> wrote in message news:uI**************@TK2MSFTNGP09.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("HiddenField"), Request.Form.Remove("HiddenField"), Request.Form.Clear(), ect, but all are read-only. I have tried using RegisterHiddenField("HiddenField","") 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**@donotemailme.com> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl...
Thanks. Now how can I detect repeating post backs?

Alex
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:O%****************@TK2MSFTNGP11.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**@donotemailme.com> wrote in message news:uI**************@TK2MSFTNGP09.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("HiddenField"), Request.Form.Remove("HiddenField"), Request.Form.Clear(), ect, but all are read-only. I have tried using RegisterHiddenField("HiddenField","") 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.com> wrote in message news:eR**************@TK2MSFTNGP11.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**@donotemailme.com> wrote in message news:%2***************@TK2MSFTNGP12.phx.gbl...
Thanks. Now how can I detect repeating post backs?

Alex
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:O%****************@TK2MSFTNGP11.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**@donotemailme.com> wrote in message news:uI**************@TK2MSFTNGP09.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("HiddenField"), Request.Form.Remove("HiddenField"), Request.Form.Clear(), ect, but all are read-only. I have tried using RegisterHiddenField("HiddenField","") 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
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...
0
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...
2
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 %>"...
17
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...
1
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...
3
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. ...
4
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...
0
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 &...
107
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...
29
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.