473,789 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Render Javascript into a WebControl.

Hi,

I am writing a grid Web control library.

The grid has some client side JavaScript to enable columns resize, sorting,
row selection etc.

I have some problems adding the JavaScript link at the render of the
control:

1) During the render method of the control I need to add the following code:

<link type="text/css" rel="stylesheet " href="includes/WLGrid.css" />
<script type="text/javascript" src="includes/WLGridSort.js"> </script>
<script type="text/javascript" src="includes/WLGridLib.js"></script>

I need this code to be rendered in the Head section of my page and NOT
in the control section.

2) In Case user put two controls on the page I want the JS code to appear
only once in the <Head> of the rendered HTML.

Thanks,

Ronen

Nov 19 '05 #1
2 1898
Ronen,

I don't it is possible to emit markup from a control directly into the HEAD
element of the page. Your alternatives are either hard-coding these lines
into the page or coming up with a send/receive solution that would involve a
control, located in HEAD element. That control will be your receiver and the
grid will be the sender.

:DG<

"Ronen" <tu******@spyma c.com> wrote in message
news:uo******** **********@TK2M SFTNGP12.phx.gb l...
Hi,

I am writing a grid Web control library.

The grid has some client side JavaScript to enable columns resize,
sorting,
row selection etc.

I have some problems adding the JavaScript link at the render of the
control:

1) During the render method of the control I need to add the following
code:

<link type="text/css" rel="stylesheet " href="includes/WLGrid.css" />
<script type="text/javascript" src="includes/WLGridSort.js"> </script>
<script type="text/javascript" src="includes/WLGridLib.js"></script>

I need this code to be rendered in the Head section of my page and NOT
in the control section.

2) In Case user put two controls on the page I want the JS code to appear
only once in the <Head> of the rendered HTML.

Thanks,

Ronen


Nov 19 '05 #2
..net does not directly support this, and you are stuck if the page does not
have a <head> section. if it does, scan the Page.Controls collection of
objects before the form object, check the generice html controls innerhtml
of the control for the <head> statement or (if user added a runat=server on
the head> a control with is tag), then update the inner html with your code
(if it is not already there).

-- bruce (sqlwork.com)
"Ronen" <tu******@spyma c.com> wrote in message
news:uo******** **********@TK2M SFTNGP12.phx.gb l...
| Hi,
|
| I am writing a grid Web control library.
|
| The grid has some client side JavaScript to enable columns resize,
sorting,
| row selection etc.
|
|
|
| I have some problems adding the JavaScript link at the render of the
| control:
|
|
|
| 1) During the render method of the control I need to add the following
code:
|
| <link type="text/css" rel="stylesheet " href="includes/WLGrid.css" />
| <script type="text/javascript" src="includes/WLGridSort.js"> </script>
| <script type="text/javascript" src="includes/WLGridLib.js"></script>
|
| I need this code to be rendered in the Head section of my page and NOT
| in the control section.
|
|
|
| 2) In Case user put two controls on the page I want the JS code to appear
| only once in the <Head> of the rendered HTML.
|
|
|
| Thanks,
|
| Ronen
|
|
|
|
|
Nov 19 '05 #3

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

Similar topics

1
3222
by: Earl Teigrob | last post by:
After I have instanced a webcontrol (in code) and set its properties, I would like to get the html that it would render to the display. Can this be done. How??? Earl
1
5956
by: Alex Nitulescu | last post by:
Hi. What's the difference between the Render method (overridden when creating custom controls) and the RenderContents method.... (overridden when creating custom controls) ? From MSDN: Render - Sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client.
0
1750
by: Henrik Stidsen | last post by:
I need to get the HTML output from a webcontrol as a string instead of it being rendered on the page. I have the following code: Dim SiteMapSource As New SiteMapDataSource() Dim TreeView1 As New TreeView() TreeView1.DataSource = SiteMapSource TreeView1.ShowExpandCollapse = True
2
1685
by: Peregrin | last post by:
Hello world. I will try to explain my problem. I've a webcontrol with an interface which provides a choice of methods. After including the webcontrol in a special aspx page, I want to call an interface webcontrol method from a javascript function part of special aspx page. But I don't know how to call a public webcontrol method from a client side javascript function ? Thanks for response.
0
9666
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
10199
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
10139
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
9983
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
9020
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...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.