How To Identify Whether "Back" Button Or "Forward" Button Was Pressed
Aug 16, 2010
I use MVC2/asp.net and try to develope something like a wizard. This wizard will have serveral websites. The user will be able to enter some information on website A and to navigate then towebsite B (by pressing a button which triggers the Http.Post event). No problem up to this point.
Also on website B can the user enter some information. But there he has two buttons: "Back" and "Forward".
I have a gridview that does a select statement against a sql database. What I want to do is have the data in the gridview refresh upon either hitting the back button or the forward button.
If the back button is pressed it should give me yesterdays data from the table. If I hit the forward button it should give me tomorrows data, at the same time i want the forward button to be limited to going forward only 5 days from todays date. I figure that I have to do this in a Updatepanel however I am unsure as to how to do this.
i m having problem with logout code in asp.net with c#. this logout code should end session, disable browser's back button and and if somebody try to login by paste the url of any user account page.i used this code in login page
customers does not want to allow user to use back or forward button. Just a clean page without commandbar and toolbar, same for FF an IE. Disabling them is not an option as now.
How should i handle browser Back and Forward button? I have aspx page . in aspx page has some field with Save Button. i have clicked on save button to save the data, then i clicked on browser back button, then it again execute the save button event. how should i prevent to fire save button event again when user clicked on Browser back button?
I am doing online quiz in a Page in my website. How i will restrict users from going backward or forward using Broowser backward or forward button in that page using ASP.Net,C#,JavaScript.
In my app, there is a grid that you can drill down. You can go back to prev view via some links but the back bowser button is not integrated to that, so that if you do hit the back browser button, it logs out of the app which I don't want. I would be happy if it would redirect to the first page. I think this part is what we need. [URL] this is the startpage.xaml, at the end there is the hyperlink - so maybe here I can see if the back browser is pressed ( there is no other place in the codes that would navigate out), and if this is pressed I can redirect to a different spot? Is this a sound idea and how do I check if this back browser has been pressed?
I am trying to implement Login/Logout functionality in my website without using inbuilt functionality of Login controls in ASP.NET. In some pages, which require the user to be logged in, I have written this in Page_Load
if (Session["cod"] == null && Session["admin"] == null) { Response.Redirect("You need to Login.aspx"); } if (Session["cod"] != null || Session["admin"] != null) { LinkButton1.Text = "Logout"; } if (Page.IsPostBack == false) { log_bind(); grid1_bind(); grid2_bind(); }
But while I was testing this, I noticed that when I press the Back/Forward button on the browser, these pages are viewable without being logged in. How do I prevent this?
I have a page, the user types in e-mail and then submits. The next page is a confirmed page - letting the user know that his -mail was entered. If you then click back, the forum will try to re-submit itself. Is there a way to stop this?
I am running one application where one gridview is there when i am deleting any data there it shows one message for deleting.
for message i used this code:
ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", string.Format("<script type='text/javascript'>alert('{0}')</script>", "this row is deleted"));
after that i am going to some other page ,after going other page when i click on back button in browser it is coming in the previous page but the message which poped up before again getting popup.
I have a gridview that does a select statement against a sql database, there is not editing, inserting or deleting just the select statement. What I want to do is have the data in the gridview refresh upon either hitting the back button or the forward button.
If the back button is pressed it should give me yesterdays data from the table. If I hit the forward button it should give me tomorrows data, at the same time i want the forward button to be limited to going forward only 5 days from todays date.
I figure that I have to do this in a Updatepanel however I am unsure as to how to do this.
I have a login page and once a person is logged in , he should not be allowed to move back to login page. how to disable backward/forward button of browser ?
I have a button, which when presses populates a grid with data. If I add an ObjectDataSource, and bind the grid to it, it will populate the grid when the page loads. But I need to populate the grid only if the button is pressed, because it is a lengthy operation.
how to make this work (I assume that no code behind is needed to make this work in its simplest form?).After user correctly answers the security question and presses submit, no email is sent. No message is displayed. Nothing. What is missing?
I have buttons contained within a repeater. A ModalPopupExtender is used to confirm event for each button. I create standard panels outside of the repeater and I attach each button in the repeater to these panels from inside the repeater. The problem is once the button is pressed in the popup I can't figure out how to determine which row of the repeater to edit as I can't figure out how to identify which button was pressed.Panel:
I am CustomValidator to vlidate some data.There are 3 static buttons and some dynamically creating buttons in that page. I just need to check validation when I press the save button.For all other button click I do not want to call the validation. How do I tell that in the Validation function?
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" ControlToValidate="DropDownList1" ClientValidationFunction="MyCustomValidation" ></asp:CustomValidator> function MyCustomValidation(objSource, objArgs) { /Proceed if the control pressed is cmdSave button. var Specialty = document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].text; if (Specialty == "Select an option") { objArgs.IsValid = false; } else { objArgs.IsValid = true; } }
Item Selected in MediaTypeDDL determines values in MediaFormatDDL. I'm using Javascript to populate MediaFormatDDL. This is working. I now select the item I want from MediaFormatDDL. That works The problem I'm seeing occurs when I press the button to save the values from the screen. I don't see the Item I selected from MediaTypeDDL. All the other fields are okay. This must be someThing simple, but I'm not seeing it.
First of all, I'm sorry if I don't describe my problem so well, English is not my first language. I'm working on a project where after the user has pressed a button, the button goes invisible and a label control should say "In 20 mintes you may press the button again". The problem is that if the user presses the button before the current hour is almost over, then he will be able to press the button again. The way I compare the time is by placing th current time, which the user presses the button in a sqldatabase table row for that user. This is my code for the moment for showing the user how long he has to wait:
DateTime TimeSincePressedbutton = Convert.ToDateTime(user.timeSincePressedButton); //value from database TimeSincePressedbutton.AddMinutes(20.00); TimeSpan d = DateTime.Now.Subtract(TimeSincePressedbutton); int dd = Convert.ToInt32(d.Minutes); int timeLeft = 20 - dd; ValPointsTitle.Text = "In " + timeLeft.ToString() + " minutes you may press the button again";
and the code I have for comparing time with the time now, is to see if the user may press the button again (which I know is wrong, just cant figure out how to fix it, the reason I compare hour, day, month, year etc is because if the user doesnt show up online the same day, maybe he comes back after a couple of days, or next month, or next year).
if (timeLeft <= 0 && DateTime.Now.Hour == TimeSincePressedbutton.Hour || DateTime.Now.Hour > TimeSincePressedbutton.Hour || DateTime.Now.Day > TimeSincePressedbutton.Day || DateTime.Now.Month > TimeSincePressedbutton.Month || DateTime.Now.Year > TimeSincePressedbutton.Year) { //button becomes visible and the user may press it again }
I have a form with several submit buttons. I would like the button's click events to fire when enter is pressed based on which textboxes currently have focus. I am able to specify one button using the code below by adding the onkeydown event to the body of the page and checking for Enter's keyCode
I assume this code can be modified or call a function to perform a conditional to see if txtSearch or txtSubmit has focus and specify btnSearch or btnSubmit accordingly, but I am not experienced with javascript.
I have an html button that makes a certain action and i have two "asp:textbox"I want the html button to be triggered when the ENTER key is pressed on keyboard.
I have an asp button which I am using in 2 different places (appending to a new place and adding a class using jquery under certain conditions). I need to slightly alter the function that runs when this button is clicked depending on whether or not this button has a given class. Is this possible??So something like this...
is it possible to create a function which will duplicate textboxes and label when a button is pressed. For example: I have Name and address textboxes and labels
Is there anyway of doing this? Its hard to explain which is why google is not my friend on this topic. But this would be neat an example may be.
Player 1 Player 2 Player 3 Player 4
Button - Add Additional Players When the button is pressed an additional player is added. Am trying my best to explain it to you, but is it possible in C# and ASP.NET?