|
|
|
how do i use my javascript to stop postback in the input is not correct i don't want it to post back to the server
here is the code:
private void Page_Load(object sender, System.EventArgs e)
{
// Form the script that is to be registered at client side.
String scriptString = "<script language=JavaScript> \n";
scriptString += "function DoClick()\n {\n";
scriptString += "\t myForm.show.value='Welcome to Microsoft .NET'; \n ";
scriptString += "return true;\n}";
scriptString += "</script>";
if(!this.IsClientScriptBlockRegistered("clientScript"))
this.RegisterClientScriptBlock("clientScript", scriptString);
button.Attributes["onclick"]="DoClick()";
}
here is the html:
<form id="myForm" runat="server">
<asp:TextBox id="show" runat="server" Width="196px"></asp:TextBox>
<asp:Button id="button" runat="server" Text="Button"></asp:Button>
</form>
Thanks
chad
-- modified at 22:40 Monday 27th February, 2006
|
|
|
|
|
If the input is not correct, return false from the javascript function.
---
b { font-weight: normal; }
|
|
|
|
|
i returned false and a postback stilled happeded i have server side code on this asp.net button which writes "server" in that textbox and i want to be able to stop that from happening
thanks
chad
|
|
|
|
|
Right. You have to return the value in the event also:
button.Attributes["onclick"] = "return DoClick()";
---
b { font-weight: normal; }
|
|
|
|
|
Use
if(!Page.IsPostBack)
button.Attributes["onclick"]="DoClick()";
Senior Software Engineer
|
|
|
|
|
Hi,
Is there a way to disable Back button for Safari? I have a submit form, let's call it "submit.aspx". Once the user clicks on "Submit" button, the information will be added into database, a confirmation email will be sent to user, then the page is redirected to confirmation page. I don't want to allow user to go back the submit page to submit for the second time. So I use history(+1) on body onload event, it works for IE. But doesn't work for Firefox and Safari.
Is there anyone having such similiar experience? How should I deal with Safari and Firefox?
Any help is appreciated!
Thanks in advance!
|
|
|
|
|
|
i need help .
i want to attach an file and send through chatting.
Having 0 - 8 Month of experience in Analysis, Design, Development of various business applications.
Good team player with excellent technical, interpersonal, very effective communication, Writing and result oriented approach skills
Having good exposure in Microsoft Technologies, Object Oriented Programming in C#, C++ and Java
|
|
|
|
|
Hi,
Is there anybody knows about the WebCast, I want to know how to implement it. like the network and hardware, software etc.
Thanks a lot!!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
I am having trouble with the window.open part of
<a onclick="window.open('KingsRdChurch.html','Kings Road Church','width=520,height=360,resizable=0,top=200,left=200,screenY=200,screenX=0');" href="javascript:void(0);"><img src="images/KingsRdChurch1.jpg" height="162" width="185" border=0 align="center">
it works fine in mozilla which is what I use. It doesnt seem to work in internet explorer. What am I doing wrong? Do I have to declare something?
|
|
|
|
|
Don't use spaces in the window name, e.g. 'KingsRoadChurch' instead of 'Kings Road Church'.
---
b { font-weight: normal; }
-- modified at 10:11 Monday 27th February, 2006
|
|
|
|
|
|
Does anybody know how to create an IFRAME so that a DIV can be placed on top of the IFRAME and SELECT?
The purpose is to allow a pop up menu not to be blocked by a windowed control e.g listbox.
I think DIV represents a windowless control like the popup menu while SELECT represents a windowed control like the listbox.
Below is a javascript file code snippet:(Contextmenu.js)
function __showContextMenu(menu)
{
var menuOffset = 55
menu.style.left = window.event.x + menuOffset;
menu.style.top = window.event.y -7;
menu.style.display = "";
window.event.cancelBubble = true;
return false;
}
function __trapESC(menu)
{
var key = window.event.keyCode;
if (key == 27)
{
menu.style.display = 'none';
}
}
There is no html because the menu is a custom control developed in C#. I have come across some IFRAME codes but they seem to be in html. How do I add IFRAME codes into this javascript file?
|
|
|
|
|
You can create an iframe element with:
var iframe = document.createElement('iframe');
Then you have to set all the needed properties of the element, and add the element to the page.
---
b { font-weight: normal; }
|
|
|
|
|
hi how i create the menu in asp or html. not asp.net or XML
prabu
|
|
|
|
|
if you have good knowledge you can use layers to create Menu and by using javascript initially set visiblity=False and onMouseOver=visiblity=True.
for ex. in you HTML page define your Menu as:
< href="Downloads.htm">Menu-1
and your pulldown.js should be having this type of code:
-------------------------
var i=50
var c=0
var intHide
var speed=15
ns6=navigator.appName==("Netscape");
if (ns6)
{
document.getElementById('myMenu').style.visibility = "visible";
}
else
{
if (document.getElementById('myMenu'))
{
document.getElementById('myMenu').style.position = "absolute";
document.getElementById('myMenu').style.visibility = "hidden";
}
function show_hide_menu()
{
if (c==0)
{
c=1
document.getElementById('myMenu').style.visibility = "visible"
document.getElementById('myMenu').style.left = document.getElementById("IMG1").offsetParent.offsetLeft ;
document.getElementById('myMenu').style.top = document.getElementById("IMG1").offsetParent.offsetParent.offsetTop + document.getElementById("IMG1").offsetParent.offsetParent.offsetHeight ;
if(intHide !=null)
clearInterval(intHide)
intShow=setInterval("show()",50)
}
else
{
c=0
clearInterval(intShow)
intHide=setInterval("hide()",50)
}
}
function show()
{
if (i<149)
{
if (i == 0)
i = 1;
document.getElementById('myMenu').style.left = document.getElementById("IMG1").offsetParent.offsetLeft ;
document.getElementById('myMenu').style.top = document.getElementById("IMG1").offsetParent.offsetParent.offsetTop + document.getElementById("IMG1").offsetParent.offsetParent.offsetHeight ;
document.getElementById('myMenu').height = i
i=i+speed
}
}
function hide()
{
if (i>150)
{
document.getElementById('myMenu').height = i
i=i-speed
}
else
document.getElementById('myMenu').style.visibility = "hidden";
}
}
------------------------
this is just a idea you can find lots of Menu Scripts from web.
Sushant Mathur
Bangalore,
INDIA.
-- modified at 3:24 Tuesday 28th February, 2006
|
|
|
|
|
|
how can web services do graphic functions?
|
|
|
|
|
|
Hi, I've developed a website in VB.Net and i'd like to see the suggestions of the users.
For that purpose i'd like to get the feedback from the users once they fill in the form.
The feedback must be sent to my email id automatically from the filled in information
When i tried i got the following error.................................
----------------------------------------------------------
the code goes like this
----------------------------------------------------------
Dim myMailServer As SmtpMail
myMessage.BodyFormat = MailFormat.Text
myMessage.Priority = MailPriority.High
myMessage.From = "xyz@urdomain.com" 'From Address
myMessage.To = "mymailid@mydomain.com" 'To Address
myMessage.Subject = "hi"
myMessage.Body = "hello"
myMailServer.SmtpServer = "smtp.net4india.com"
'This is my mail server
myMailServer.Send(myMessage)
myMessage = Nothing
----------------------------------------------------------
error msg is like this
----------------------------------------------------------
The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
Source Error:
Line 103: myMailServer.SmtpServer = "smtp.net4india.com" 'This is my mail server "
Line 104: myMailServer.Send(myMessage)
|
|
|
|
|
|
Hi,
I'm having trouble with parsing an XML file from Yahoo's Geocoder.
I'm getting an (0x800A01A8) Object required error on the line following line: Response.Write "Latitude" & xmlDoc.selectSingleNode("Latitude").Text
If I coment that our I get the same error on the next line.
Here is my code and the xml file I should be returning follows.
<%<br />
<br />
xmlURL = "http://api.local.yahoo.com/MapsService/V1/geocode?appid=SmartStart&street=3821%20Plantation%20Ln%20&zip=75035"<br />
<br />
'// Create the XMLHTTP object<br />
Set xmlHTTP = Server.CreateObject("MSXML2.XMLHTTP")<br />
<br />
'
xmlHTTP.Open "GET", xmlURL<br />
xmlHTTP.Send <br />
<br />
'// Load the XML parser<br />
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")<br />
xmlDoc.Async = False<br />
xmlDoc.loadXML (xmlHTTP.ResponseXML.xml)<br />
<br />
'
Set arrResult = xmlDoc.selectSingleNode("//ResultSet/Result")<br />
<br />
'// Show Latitude and Longitude<br />
Response.Write "Latitude" & arrResult.selectSingleNode("Latitude").Text<br />
Response.Write "Longitude" & ArrResult.selectSingleNode("Longitude").Text<br />
<br />
'
Set xmlDoc = Nothing<br />
<br />
'// Destroy the object<br />
Set xmlHTTP = Nothing<br />
<br />
%>
Yahoo XML:
<br />
<?xml version="1.0" encoding="UTF-8" ?> <br />
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:maps" xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"><br />
<Result precision="address"><br />
<Latitude>33.109863</Latitude> <br />
<Longitude>-96.781642</Longitude> <br />
<Address>3821 PLANTATION LN</Address> <br />
<City>FRISCO</City> <br />
<State>TX</State> <br />
<Zip>75035-8587</Zip> <br />
<Country>US</Country> <br />
</Result><br />
</ResultSet><br />
<!-- ws01.search.re2.yahoo.com compressed/chunked Fri Feb 24 06:41:55 PST 2006 --> <br />
Thank you,
Jim
|
|
|
|
|
Disable html in your post. I can't see what the xml looks like.
---
b { font-weight: normal; }
|
|
|
|