473,382 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

link button client csript

I have linkButton:
<asp:LinkButton ID="lnkAddMedia" runat="server" CausesValidation="false"
Text="ADD media"></asp:LinkButton>

In code behind file(c#) I add a client script to this link button:
lnkAddMedia.OnClientClick="vbscript:selectMedia('1 ')";

When page is rendered, the rendered code is:

<a onclick="vbscript:selectMedia('1');"
id="ctl00_ContentPlaceHolder1_lnkAddMedia"
href="javascript:__doPostBack('ctl00$ContentPlaceH older1$lnkAddMedia','')">ADD
media</a>

and I get script error message on the page:
error: Expected end of statement

I guess that error is because of semicolon, which is added to my script:
vbscript:selectMedia('1');
(vbSCript doesn't have semicolons).

This semi colon was added automatically. How can I remove that?

One way is to put javascript instead of vbscript, but I preffer programming
in vbscript, because I have all program written in this language.
Thank you for your answers,
Simon
Nov 28 '05 #1
2 1856
Why not use:

lnkaddmedia.attributes.add("onclick","vbscript:sel ectMedia(1)")

That shouldn't do any special formatting.

----
700cb Development, Inc.
http://www.700cb.net
..NET utilities, developer tools,
and enterprise solutions

"Simon" <si*********@studio-moderna.com> wrote in
news:uX**************@TK2MSFTNGP14.phx.gbl:
I have linkButton:
<asp:LinkButton ID="lnkAddMedia" runat="server"
CausesValidation="false" Text="ADD media"></asp:LinkButton>

In code behind file(c#) I add a client script to this link button:
lnkAddMedia.OnClientClick="vbscript:selectMedia('1 ')";

When page is rendered, the rendered code is:

<a onclick="vbscript:selectMedia('1');"
id="ctl00_ContentPlaceHolder1_lnkAddMedia"
href="javascript:__doPostBack('ctl00$ContentPlaceH older1$lnkAddMedia','
')">ADD media</a>

and I get script error message on the page:
error: Expected end of statement

I guess that error is because of semicolon, which is added to my
script: vbscript:selectMedia('1');
(vbSCript doesn't have semicolons).

This semi colon was added automatically. How can I remove that?

One way is to put javascript instead of vbscript, but I preffer
programming in vbscript, because I have all program written in this
language.
Thank you for your answers,
Simon


--
Dec 4 '05 #2
Hi,

"lnkaddmedia.attributes.add" is obsolete - that is massage given by new
visual studio 2005.

So I use "lnkAddMedia.OnClientClick" - that is recomended method by VS2005.

But no matter which method I use, I always get the semicolon when the page
is rendered.

I don't know why?

So I rewrite my function to javascript but still I would like to know the
reason.

I have the latest Visual studio 2005 version: 8.0.50727.42, asp.net version:
2.0.50727 and project is in C# language.

Any idea?

Regards,S

"cbDevelopment" <de*****@remove.700cb.net> wrote in message
news:Xn***************************@207.46.248.16.. .
Why not use:

lnkaddmedia.attributes.add("onclick","vbscript:sel ectMedia(1)")

That shouldn't do any special formatting.

----
700cb Development, Inc.
http://www.700cb.net
.NET utilities, developer tools,
and enterprise solutions

"Simon" <si*********@studio-moderna.com> wrote in
news:uX**************@TK2MSFTNGP14.phx.gbl:
I have linkButton:
<asp:LinkButton ID="lnkAddMedia" runat="server"
CausesValidation="false" Text="ADD media"></asp:LinkButton>

In code behind file(c#) I add a client script to this link button:
lnkAddMedia.OnClientClick="vbscript:selectMedia('1 ')";

When page is rendered, the rendered code is:

<a onclick="vbscript:selectMedia('1');"
id="ctl00_ContentPlaceHolder1_lnkAddMedia"
href="javascript:__doPostBack('ctl00$ContentPlaceH older1$lnkAddMedia','
')">ADD media</a>

and I get script error message on the page:
error: Expected end of statement

I guess that error is because of semicolon, which is added to my
script: vbscript:selectMedia('1');
(vbSCript doesn't have semicolons).

This semi colon was added automatically. How can I remove that?

One way is to put javascript instead of vbscript, but I preffer
programming in vbscript, because I have all program written in this
language.
Thank you for your answers,
Simon


--

Dec 5 '05 #3

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

Similar topics

21
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
7
by: ravey | last post by:
I would like to use a Form "button" (or "input", either one) within an anchor, instead of using text or creating a graphic. This works fine in all browsers but IE, but IE, while showing the...
4
by: Mike Woinoski | last post by:
(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java web services and need to test them with C++ clients. I can use either a Windows Form application or an MFC application....
8
by: simon | last post by:
On code behind file: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then Dim ctrl As New LinkButton ctrl.ID =...
13
by: John M | last post by:
Hello, In Visual studio .NET 2003, On datagrid object : How can I link the button element : edit, to do a some client events (such as message box, and do another event just after that to the...
5
by: Sean M. Loftus | last post by:
I have a need to call an html page into the pane I'm viewing using a button on an ASP page. The page itself is an ASP page called from a website. I know a link would work but the rest of the page...
1
by: JJ | last post by:
I have an app and on one page I have Link buttons that will fire up a word doc or at least thats my goal. When someone clicks on a link button I need to find a word doc on server where app resides....
4
by: kschneider | last post by:
Assume there's a form with it's action attribute all set to post to a URL, but without a submit control. Form submission is done via a link and I want to prevent the classic "double submit"....
5
by: Julia | last post by:
Hi I have a webcontrol.button on a asp.net page. When the user clicks the button I would like to dynamically build a link with values from the config file and then open this link. I know how...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.