473,657 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1805
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.U I.WebControls.T oolbarLabel LblButton =
(Microsoft.Web. UI.WebControls. ToolbarLabel)se nder;

if(LblButton.Te xt.IndexOf(" Save") > -1)

{

LiteralControl li1=new LiteralControl( );

li1.Text="<scri pt>alert('Butto n Save is clicked.');</script>";

Page.Controls.A dd(li1);

}

else if(LblButton.Te xt.IndexOf("Pri nt") > -1)

{

LiteralControl li2=new LiteralControl( );

li2.Text="<scri pt>alert('Butto n Print is clicked.');</script>";

Page.Controls.A dd(li2);

}

}

Hope this helps.

Regards,

Marshal Antony

..NET Developer

http://www.dotnetmarshal.com

"Ashish" <no****@myself. com> wrote in message
news:e$******** ********@TK2MSF TNGP12.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******** ********@TK2MSF TNGP11.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.U I.WebControls.T oolbarLabel LblButton =
(Microsoft.Web. UI.WebControls. ToolbarLabel)se nder;

if(LblButton.Te xt.IndexOf(" Save") > -1)

{

LiteralControl li1=new LiteralControl( );

li1.Text="<scri pt>alert('Butto n Save is clicked.');</script>";

Page.Controls.A dd(li1);

}

else if(LblButton.Te xt.IndexOf("Pri nt") > -1)

{

LiteralControl li2=new LiteralControl( );

li2.Text="<scri pt>alert('Butto n Print is clicked.');</script>";

Page.Controls.A dd(li2);

}

}

Hope this helps.

Regards,

Marshal Antony

.NET Developer

http://www.dotnetmarshal.com

"Ashish" <no****@myself. com> wrote in message
news:e$******** ********@TK2MSF TNGP12.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
2024
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 solutions. 1. Opens a new Window at maximum size: window.moveTo(0,0,screenX=0,screenY=0) window.resizeTo(screen.availWidth+2,screen.availHeight+6)
14
5453
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 that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
4
2892
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 object. The code is listed below but the event is never attached. The 'this' reference for the button seem to be correct and the 'self' reference to the control(object) also seems to be correct.
0
6426
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 be modified: if(e.CommandName =="Print") { string parsedreceipt = null; parsedreceipt = DecodeReceipt (e.Item.Cells.Text); Session = parsedreceipt;
9
4907
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 fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
2
2469
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 btnPrintCommunities_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintCommunities.Click End Sub
4
3500
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 click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
2
2683
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 trying to highlight certain predefined words on particular web sites through the IE plugin itself. To add an IE button, I've found this neat article:
1
2467
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 webiste by downloading the toolbar from our website. After the member downloads the toolbar, The toolbar is added to the ie browser. The member can get the facilities such as searching, weather online, internet radio,etc., The toolbar includes a...
0
8427
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
8850
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...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
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
8626
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
7355
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
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
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.