Re: use javascript without postback




vinay wrote:
Hi All
I have a page in which i using user control .on user control i using
javascript to pop up a message .when i choose wrong date in user
control & submits the page it alerts the message of javascript but
page refrehes. I want to use javascript without page refresh or without
postback .
Is this possible to use javascript without page postback..
Thanks in advance
Vinay

Yes. It sounds like you are doing a form validation, however on
invalid entry, you are failing to stop the form submission. In that
case, you can do something like the following:

html:

<form onsubmit = "return validateForm(this)">
....your form elements...
<input type = "text" name = "userdate">
</form>

javascript:

function validateForm(myForm)
{
/*your validation routine
.
.
.
*/
if(myForm.elements["userdate"] == "some_value")
{
return true;
}

return false; //for invalid entry return false, for valid entry
return true
}

.



Relevant Pages

  • Re: ajax and asp.net in user control
    ... olivier wrote: ... ** *I want to use javascript in User Control but to call* ... ** *If my user control *is called MyControl. ... "startUpScript", startUpScript); ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Autopostback fails because of script error
    ... This user control contains a number of ASP list boxes and an ASP ... >> javascript that makes the autopostback feature work. ... >> Ethan Adams ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: multiple javascript for user controls
    ... You can use an ASP.NET feature to register the scripts. ... identify them with keys. ... I have a usercontrol which includes a small piece of Javascript built up ... If I use multiple instances of the same user control on a page, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: File download problem - content-disposition as attachment brea
    ... hosts a dynamically created user control. ... The files are then streamed from the server on their Clickevents. ... the page still had it's javascript references. ... and after the download completes all javascript functions ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Add client event to user control?
    ... And there is javascript ... >> user control, and I can set the properties of it in my aspx.vb page. ... >> When I click the SaveContinue button in the user control, ... >> End Sub ...
    (microsoft.public.dotnet.framework.aspnet)