|
First off - this is the wrong forum for this question - you should have posted it in "JavaScript".
Secondly, code blocks should be wrapped using the "code block" button above the editor when posting.
Having said all that, you code behaves as it does because you are catching the keyup event on the backspace key just like any other. You need your code to be of the form:
if (event.keyCode == 8) {
} else {
}
Also, I suspect you have only been testing/using this in IE - you may need to look at how Firefox sees it...
|
|
|
|
|
In reply to your answer, the code will only ever run in IE as it is an internal web application not a website, so testing in Firefox or in Google Chrome is not required. When testing in IE, the javascript is not hitting if the statement and is thus not working as expected.
|
|
|
|
|
Well OK, but you still need to write it along the lines I suggested. Of course, you need also to check for valid input at some stage - eg as is a user could enter 99/99/9999.
|
|
|
|
|
Hi,
In my webapplication i gave links to open certain pdf files.
But i don't want users to save them to their local pc.
How can we do that?
|
|
|
|
|
SUDHAKAR PALLAM wrote: But i don't want users to save them to their local pc.
You can't. Where do you think the PDF is displayed from when you open it up in the web browser? That's right, it's already on the local PC in the browser cache.
|
|
|
|
|
I am tring to access to the user´s selected text inside the text contained in an TextBox ASP .Net server control, but because I do not want to get all the text but only the selected by the user I cann't use the text property, please any suggestion for do it with the TextBox or with another control which let do it inside a an ASP .Net site.
I choose TextBox Multiline because it yields an TextArea Html tag in the explorer and because there is no a RitchTextBox control in ASP .Net but perhaps is there an other control for do it.
Best regards
|
|
|
|
|
|
|
Hi,
I have an asp.net webpage with multiple textboxes filled with data, If user uses browser search(ctrl+F) the text in textboxes is not highlighted.
How to achieve this?
Thanks
Baba
|
|
|
|
|
You need to find some other control that renders the value without using an input element like many of the rich text box controls.
|
|
|
|
|
Hi,
If I want to destroy a page from my website and display (Page Can't be displayed)! if user trued to browse after he sign out my web site using my sign out button.
how can can I do this?
|
|
|
|
|
Probably by asking somewhat less question here.
You could have Google to search first. If you find it hard or getting stucked to any point then you can come here.
|
|
|
|
|
but how can I search? what keywoord? I tried expiring (set expire to 0 and -1 the page but didn't work
|
|
|
|
|
jrahma wrote: but how can I search?
http://www.google.com
jrahma wrote: what keywoord?
Probably with what you want.
jrahma wrote: I tried expiring
Try for more then 10 min, you can not get solution easily.
If you'll be habitual to get help from others always, You will never learn anything from yourside, Just show some tendency to learn and you'll have you answer.
Best Luck !!
|
|
|
|
|
That is not a Correct Term. Tell me if i misunderstood your question.
When the User logout on your app,if they try to access your app again , you want to send them to a login again before they enter ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
exactly OR display Page ca;t be displayed!....
Currentlly when the user logout my app ad click back button on the browser he'll still be able to view the data.
|
|
|
|
|
Ok , What you need to do, is that When He Successfully logged in , you need to store his username on the Session e.g
if(Success)
{
Session["Username"] = "The Username";
}
this code should in your Login Button , and when the User Decides to Logout , then You need to clear the Session , e.g
Session["Username"] = null;
Now on the Page load event of every page , you need to Check if the User has logged in , if the Session is Null, it means that the user has not logged in, then you can Redirect that user to the Login page. e.g
if(Session["Username"] == null)
{
Response.Redirect("Login.aspx",false);
}
make sure that this code is not inside a code like this
if(!page.ispostback)
{
}
Keep it outside , so that it will always check it.
Hope this helps
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
jrahma wrote: If I want to destroy a page from my website and display (Page Can't be displayed)! if user trued to browse after he sign out my web site using my sign out button.
Your question is not worded properly. But, as per your question, what I understood it, If user sign out from your application, you don't to revisit the page again and insted of that you want to show "Page Can't be displayed"
Use Session.Abandon() when user sign out from your application.
and check the Session Variable for null on the page_load in your page, if it's null, redirect to "can't displayed page"
as,
If(Session["UserName"] == null)
{
Response.Redirect("PageNotDisplayed.aspx");
}
else
{
}
|
|
|
|
|
Well, browers back button does not reloads the whole page and so I have to disagree with other replies about clearing the session. It happens, because of browser cache and you need to clear that out after logout.
Try:
code for clearing cache can be put up in code behind as follows:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
You can add somethin similar in form aspx if you want to place it there:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
OR
You can clear browser history through JavaScript....
<SCRIPT LANGUAGE=javascript> { var Backlen=history.length; history.go(-Backlen); window.location.href=page url }</SCRIPT>
OR
Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);
OR as you say in you logout event:
protected void LogOut()
{
Session.Abandon();
string nextpage = "Logoutt.aspx";
Response.Write("<script language=javascript>");
Response.Write("{");
Response.Write(" var Backlen=history.length;");
Response.Write(" history.go(-Backlen);");
Response.Write(" window.location.href='" + nextpage + "'; ");
Response.Write("}");
Response.Write("</script>");
}
Had you searched this very site 'Question & Answer' section, you would had found this answer.
|
|
|
|
|
Sandeep Mewara wrote: browers back button does not reloads the whole page and so I have to disagree with other replies about clearing the session
He didn't mentioned it any where that, he want to navigate it using browser back button. So, I don't think other answer are wrong. Yes, On back button it's never reload the page, but what about copy the previous url and paste it in different tab ?
BTW: your answer is well explained +5, I will suggest you to put it as Tips n Ticks in CP and in future you / we can use the same from there
|
|
|
|
|
Abhijit Jana wrote: He didn't mentioned it any where that, he want to navigate it using browser back button
Here[^]... he explained it while discussing the previous answer. I won't blame you or other answerers for the session thing as OP failed to explain his problem properly in the first place itself.
Abhijit Jana wrote: BTW: your answer is well explained +5, I will suggest you to put it as Tips n Ticks in CP and in future you / we can use the same from there
Sure, why not.
OT: So, how are you. Looks like, a lot busy these days giving tech-talks..
|
|
|
|
|
Sandeep Mewara wrote: I won't blame you or other answerers for the session thing
Sandeep Mewara wrote: OT: So, how are you. Looks like, a lot busy these days giving tech-talks..
Yes, kind off.
Dude, Tomorrow traveling to Pune for first Indian Code Project Member meet. We will miss you there. Thoug very less number of people and it's an unofficial meet still we will make something big next time and hope to see you there.
Why you are not in gtalk now a days ?
|
|
|
|
|
Abhijit Jana wrote: Dude, Tomorrow traveling to Pune for first Indian Code Project Member meet. We will miss you there. Thoug very less number of people and it's an unofficial meet still we will make something big next time and hope to see you there.
Hey, thats wonderful. Hope you guys enjoy to fullest. Mere naam pe kuch kha/pee lena
Aur haan, don't forget to capture the things... atleast virtually we can attend
Abhijit Jana wrote: hope to see you there.
Why you are not in gtalk now a days ?
Don't ask. Lots of work and office mein gtalk pe rehte hi nahi. Further, once I am back at home (like now), I avoid logging into gtalk. Hopefully, January se atleast login kar payenge... till then you will still don't find me online there.
|
|
|
|
|
Sandeep Mewara wrote: Mere naam pe kuch kha/pee lena
Sure
Sandeep Mewara wrote: don't forget to capture the things... atleast virtually we can attend
Sure. My digi cam is on charge
|
|
|
|
|
Will wait for the snaps!
BTW, as you said, posted it[^] right away.
|
|
|
|