473,698 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem when generating Client Side Script.

I use in Render( HtmlTextWriter output) :

//--------------------------------------------------------------------------

output.WriteBeg inTag( "a" );

if( ID != null )

output.WriteAtt ribute( "id", ClientID );
output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

output.Write( HtmlTextWriter. TagRightChar );

if( Text.Length > 0 )

output.Write( Text );

output.WriteEnd Tag( "a" );

//--------------------------------------------------------------------------
-------------------------

This creates the HTML:

<a id="WebLinkButt onCtrl1"
href="javascrip t:__doPostBack( 'WebLinkButtonC trl1','')">Type something
here</a>

The problem is when I press the button as it gives a:

Microsoft JScript runtime error: Object expected

Does anyone have any ideas as how to solve this as it appears to be
happening whenever I use

output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

even when they are copied from samples etc.

Thanks

John.
Nov 17 '05 #1
2 2649
It was because the control wasn't inside the form tag.

Does anyone know why this is the case?

"John Owens" <jo****@vision. com> wrote in message
news:ed******** ******@tk2msftn gp13.phx.gbl...
I use in Render( HtmlTextWriter output) :

//--------------------------------------------------------------------------
output.WriteBeg inTag( "a" );

if( ID != null )

output.WriteAtt ribute( "id", ClientID );
output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

output.Write( HtmlTextWriter. TagRightChar );

if( Text.Length > 0 )

output.Write( Text );

output.WriteEnd Tag( "a" );

//-------------------------------------------------------------------------- -------------------------

This creates the HTML:

<a id="WebLinkButt onCtrl1"
href="javascrip t:__doPostBack( 'WebLinkButtonC trl1','')">Type something
here</a>

The problem is when I press the button as it gives a:

Microsoft JScript runtime error: Object expected

Does anyone have any ideas as how to solve this as it appears to be
happening whenever I use

output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

even when they are copied from samples etc.

Thanks

John.

Nov 17 '05 #2
Hi,

I haven't check your code, but one thing I can be sure of, the controls
should be inside a form.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"John Owens" <jo****@vision. com> wrote in message
news:%2******** *******@tk2msft ngp13.phx.gbl.. .
It was because the control wasn't inside the form tag.

Does anyone know why this is the case?

"John Owens" <jo****@vision. com> wrote in message
news:ed******** ******@tk2msftn gp13.phx.gbl...
I use in Render( HtmlTextWriter output) :

//--------------------------------------------------------------------------

output.WriteBeg inTag( "a" );

if( ID != null )

output.WriteAtt ribute( "id", ClientID );
output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

output.Write( HtmlTextWriter. TagRightChar );

if( Text.Length > 0 )

output.Write( Text );

output.WriteEnd Tag( "a" );

//--------------------------------------------------------------------------
-------------------------

This creates the HTML:

<a id="WebLinkButt onCtrl1"
href="javascrip t:__doPostBack( 'WebLinkButtonC trl1','')">Type something
here</a>

The problem is when I press the button as it gives a:

Microsoft JScript runtime error: Object expected

Does anyone have any ideas as how to solve this as it appears to be
happening whenever I use

output.WriteAtt ribute( "href", "javascript :" +
Page.GetPostBac kEventReference ( this ) );

even when they are copied from samples etc.

Thanks

John.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4335
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side vbscript reads the database and populates a listbox on the page with the first field from each record in the recordset. This works fine. - User selects an option on the listbox and, using the OnChange, I
4
4699
by: scott cooper | last post by:
I hope this illustrates my question a little better. Consider the following script; why does the client side script change the div object's innerHtml property but the server side script does not? Debug reports that the server script does not see the document's div object but I thought I read that varibles created with page scope are available throughout the page. <%@ language="VBSCRIPT" %> <html> <head>
3
2344
by: Brian | last post by:
Hi I'm trying to get a small script working I need to get the user to input some info from a prompt and then use that info in a PHP script, but I can't seem to assign the JavaScript var to a PHP var <?PHP if ($do == 'ban') {
13
1885
by: nobody | last post by:
Hello all, I've searched just about everything and although I can see that other people are having problems, but theirs don't seem to relate, so in a last ditch attempt, my posting! Script tags are hanging in ie when generating a html page in a new window. Works fine in netscape/moz. I know ie does some weird things with scripts but...
2
5143
by: Guadala Harry | last post by:
In an aspx file I have declared a hidden field like this: <input id="hTestVal" type=hidden value="-1" runat="server"> Defined in the code-behind like this: protected System.Web.UI.HtmlControls.HtmlInputHidden hTestVal; In client-side JavaScript I set the value like this: document.all("hTestVal").Value = "yo"; The problem is that the value of the hidden field (hTestVal) does not get
21
1679
by: Phil Powell | last post by:
<script type=\"text/javascript\"> <!-- var browserArray = new Array(\"Microsoft Internet Explorer\", \"Netscape\"); if (browserArray.in_array(navigator.appName, browserArray) && navigator.appName == \"Microsoft Internet Explorer\" && parseInt(navigator.appVersion) >= 4 ) { // IE USERS
5
1304
by: bspittles | last post by:
Can anyone tell me why the following script doesn't work in Firefox 1.5 (not sure about other versions) when it works fine in IE6 and Netscapes 7.1? Almost as importantly ;) can ayone tell me how to fix it? <script language=javascript> function showphoto(pic, player, w, h, winname) { photowin = window.open("",winname, "menubar=no,width=" + w + ",height=" + h + ",resize=no"); photowin.document.write("<HTML><HEAD><TITLE>" + player +
7
6279
by: Alex Maghen | last post by:
I have some client-side JavaScript that I want to run whenever a pulldown <SELECT> is changes on th client. I'm trying to do this as follows... <select id="MyPulldown" onchange="handleProblemChange();" runat="server"> If I do this, I get client-side javascript errors because the id "MyPulldown" doesn't exist. It's been mangled into this crazy-named thing that I can't use. How do I fix this so that the ID that I give it ends up being...
102
6785
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem never to send if-modified-since. But the strange thing is that Opera sends if-modified-since but when I reply with "HTTP/1.0 304 Not Modified" it is not refreshing the screen from its cache, it is leaving the screen blank.
9
1273
by: djconner | last post by:
I'm a total neophyte in Javascript, trying to hack something together fast, and run into something that I can't understand at all. Two loops appear in sequence. The idea is that arrQuestions consists of the answers to each of 6 questions. Each is answered by a number, 0-5, and each number can only be used once. So arrNumbers tracks whether a particular number was used as an answer. arrNumbers would be set to 'Used' if the user...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7740
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.