473,323 Members | 1,589 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,323 software developers and data experts.

Attach javascript to toolbar button

Hello,
I am sick and tired of ochestrating server and client side scripts.
Basically I am using toolbar from IE web controls and want to attach
javascript to one of the buttons' click event. The problem is that button
doesnt exposes attribute collection. I can attach javascript to whole
toolbar but 1. it would defeat the purpose of only attaching client scripts
to some buttons 2. i would have no means of identifying which button was
clicked....

Please help !!! Thanks !!!
Ashish
Nov 18 '05 #1
2 1789
Hi Ashish,
For eg :
In the ButtonClick event of your Toolbar,
If you have 2 buttons with button text Save and print ,
if (sender.GetType().ToString() ==
"Microsoft.Web.UI.WebControls.ToolbarButton")
{

Microsoft.Web.UI.WebControls.ToolbarLabel LblButton =
(Microsoft.Web.UI.WebControls.ToolbarLabel)sender;

if(LblButton.Text.IndexOf(" Save") > -1)

{

LiteralControl li1=new LiteralControl();

li1.Text="<script>alert('Button Save is clicked.');</script>";

Page.Controls.Add(li1);

}

else if(LblButton.Text.IndexOf("Print") > -1)

{

LiteralControl li2=new LiteralControl();

li2.Text="<script>alert('Button Print is clicked.');</script>";

Page.Controls.Add(li2);

}

}

Hope this helps.

Regards,

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com

"Ashish" <no****@myself.com> wrote in message
news:e$****************@TK2MSFTNGP12.phx.gbl...
Hello,
I am sick and tired of ochestrating server and client side scripts.
Basically I am using toolbar from IE web controls and want to attach
javascript to one of the buttons' click event. The problem is that button
doesnt exposes attribute collection. I can attach javascript to whole
toolbar but 1. it would defeat the purpose of only attaching client scripts to some buttons 2. i would have no means of identifying which button was
clicked....

Please help !!! Thanks !!!
Ashish

Nov 18 '05 #2
Hi Antony,
Thanks a lot ... worked like a charm...
Ashish

"Marshal Antony" <do***********@yahoo.com> wrote in message
news:O2****************@TK2MSFTNGP11.phx.gbl...
Hi Ashish,
For eg :
In the ButtonClick event of your Toolbar,
If you have 2 buttons with button text Save and print ,
if (sender.GetType().ToString() ==
"Microsoft.Web.UI.WebControls.ToolbarButton")
{

Microsoft.Web.UI.WebControls.ToolbarLabel LblButton =
(Microsoft.Web.UI.WebControls.ToolbarLabel)sender;

if(LblButton.Text.IndexOf(" Save") > -1)

{

LiteralControl li1=new LiteralControl();

li1.Text="<script>alert('Button Save is clicked.');</script>";

Page.Controls.Add(li1);

}

else if(LblButton.Text.IndexOf("Print") > -1)

{

LiteralControl li2=new LiteralControl();

li2.Text="<script>alert('Button Print is clicked.');</script>";

Page.Controls.Add(li2);

}

}

Hope this helps.

Regards,

Marshal Antony

.NET Developer

http://www.dotnetmarshal.com

"Ashish" <no****@myself.com> wrote in message
news:e$****************@TK2MSFTNGP12.phx.gbl...
Hello,
I am sick and tired of ochestrating server and client side scripts.
Basically I am using toolbar from IE web controls and want to attach
javascript to one of the buttons' click event. The problem is that button doesnt exposes attribute collection. I can attach javascript to whole
toolbar but 1. it would defeat the purpose of only attaching client

scripts
to some buttons 2. i would have no means of identifying which button was
clicked....

Please help !!! Thanks !!!
Ashish


Nov 18 '05 #3

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

Similar topics

3
by: annon | last post by:
I've noticed that some problems come up frequently that are of importance in writing web pages, because they're pretty fundamental points. For general reference, here are some collected...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
4
by: bhatiaajay | last post by:
I am new to JavaScript objects. The object creates a button with no events attached. Later I want to attach an event to the button created by this object. The event attaches a function in the...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
2
by: DC Gringo | last post by:
Using vb.net, I have a button control: <asp:Button OnClick="communitiesPrintReport()" id="btnPrintCommunities" runat="server" Text="Button"></asp:Button> Private Sub...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
2
by: 9icj4u613jeqrx8 | last post by:
Hi, I need some help with IE browser programming (in .NET). I'm trying to add a button to the IE toolbar, and on the click of the button open a popup window with a remote URL. Secondly, I'm...
1
by: jmohan | last post by:
Dear Sir/Madam, I develop a website in asp.net with c#. And also, I develop a toolbar in the toolbar studio separately. Aim of the Website: Enabling the visitors to become a member of our...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.