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

User control with Javascript function

Hi,

I have an User Control which uses css and javascript files. How should I add
them to the main page? When I place this User Control twice on the page, how
to add reference to these files only once.

Thanks
Lukas
Apr 18 '06 #1
3 1550
Why don't you add the links to the javascript and css files to the
containing page?

"Lukas Kurka" <ku******@seznam.cz> wrote in message
news:e2**********@ns.felk.cvut.cz...
Hi,

I have an User Control which uses css and javascript files. How should I
add them to the main page? When I place this User Control twice on the
page, how to add reference to these files only once.

Thanks
Lukas

Apr 18 '06 #2
you can use RegisterClientScriptBlock to include the javascript, either the
actual code or link. The style is more difficult. most control just have a
property to set the class name, and don't worry about defining the class.

you could write a style control, that allowed your user control to register
their css links.

-- bruce (sqlwork.com)
"Lukas Kurka" <ku******@seznam.cz> wrote in message
news:e2**********@ns.felk.cvut.cz...
Hi,

I have an User Control which uses css and javascript files. How should I
add them to the main page? When I place this User Control twice on the
page, how to add reference to these files only once.

Thanks
Lukas

Apr 18 '06 #3
I will probably do it this way. I just wanted to make my code more
understandable, this way adding the user control is not enough, you have to
know that you must add this javascript and css reference as well.

Lukas

"Onwuka Emeka" <bu******@hotmail.com> wrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
Why don't you add the links to the javascript and css files to the
containing page?

"Lukas Kurka" <ku******@seznam.cz> wrote in message
news:e2**********@ns.felk.cvut.cz...
Hi,

I have an User Control which uses css and javascript files. How should I
add them to the main page? When I place this User Control twice on the
page, how to add reference to these files only once.

Thanks
Lukas


Apr 18 '06 #4

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

Similar topics

2
by: Jakub Gutkowski | last post by:
Hi, Dose anybody knows how to call JavaScript function in C# Windows User Control? I use Windows User Control as smth like ActiveX, 'coz I need to call
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a button, the whole form is submitted. Now at this stage...
0
by: Jakub Gutkowski | last post by:
Hi, Dose anybody knows how to call JavaScript function in C# Windows User Control? I use Windows User Control as smth like ActiveX, 'coz I need to call functions from my User Control from...
4
by: Barb | last post by:
I have a user control as my Save button for my page. When the Save button is clicked, I want some client-side validation to take place from a javascript function in the page, and then I'd like the...
3
by: Ant | last post by:
I'm building a Web user control that has several public functions. Can I fire them from the client side? for example Javascript and an HTML button
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
3
by: anadimpa | last post by:
Hello all I build a javascript function string in the code behind and register it in the Page_Load of my User Control. I do this because I build the javascript based on some variables that are...
3
by: =?Utf-8?B?Qw==?= | last post by:
Hi, I have a user control which I use on all my pages. The control is situated on the top of my page (sits on my master page). For some long pages the user has to scroll back up to the top of...
4
by: archana | last post by:
Hi all, i am having one user control. what i want is to add javascript which will gets called on button click of user control. but user control is not working if i add javascript in user...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.