473,399 Members | 2,774 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,399 software developers and data experts.

Designer support question

JKJ
I have a custom web control that needs a javascript file
to be included as part of the project. I want to have the
control automatically add the file in a specific folder to
the project when the control is added to the designer.
I've been looking for some kind of designer class, but
can't find anything that will enable me to do what I want
to do. Can anybody point me in the right direction?

Thanks!
Nov 15 '05 #1
3 1125
this is a very reasonable request, but to my knowledge it
hasn't been done yet because the location of a file in
general is unknown.

you might look at the DesignOnlyAttribute documentation
and prompt the user to locate the file if it's not yet
part of the project. i'm not sure how you detect whether
it already is, but that should be doable.

while we're on the subject, perhaps a better way of doing
that is to package the javascript file in an assembly
with the control-- then it's sure to be there.

-----Original Message-----
I have a custom web control that needs a javascript file
to be included as part of the project. I want to have thecontrol automatically add the file in a specific folder tothe project when the control is added to the designer.
I've been looking for some kind of designer class, but
can't find anything that will enable me to do what I wantto do. Can anybody point me in the right direction?

Thanks!
.

Nov 15 '05 #2
Hi,

As far as I know, you can specify a designer for any control with the
DesignerAttribute class. What you can do is inheriting from a standard
designer and overriding some methods to automatically add the JavaScript
file. Please note that I am not sure this is 100% possible - it's just a
direction to start digging towards.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"JKJ" <my*******@mchsi.com> wrote in message
news:04****************************@phx.gbl...
I have a custom web control that needs a javascript file
to be included as part of the project. I want to have the
control automatically add the file in a specific folder to
the project when the control is added to the designer.
I've been looking for some kind of designer class, but
can't find anything that will enable me to do what I want
to do. Can anybody point me in the right direction?

Thanks!


Nov 15 '05 #3
JKJ
I saw this in action via a control from Devmansion.com.
You add a control to the webform and supporting files are
automatically included in the project.

The *.js file is part of the project, and included as
contents. When the control is packaged, it will be in
the root directory of the library. I can reference the
file there.

I have also embedded the script itself in a resource file
and can read the contents of the .js into the .aspx at
runtime, but this increases the size of the page by a few
KB. I'd much rather have the control insert a <script>
tag with a src attrib, than the entire script itself.

I tried creating the file @ runtime and saving it in the
folder in the application root. If the folder doesn't
exist, then it creates that as well. If the file already
exists, then no action is taken. If by chance it gets
deleted, the control will detect that it is missing and
recreate the js file.

HOWEVER, to perform this action the ASP.NET worker
process needs to have write permissions on the directory,
and in the grand scheme of things, I think this could be
percieved as security issue.
-----Original Message-----
I have a custom web control that needs a javascript file
to be included as part of the project. I want to have thecontrol automatically add the file in a specific folder tothe project when the control is added to the designer.
I've been looking for some kind of designer class, but
can't find anything that will enable me to do what I wantto do. Can anybody point me in the right direction?

Thanks!
.

Nov 15 '05 #4

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

Similar topics

3
by: thechaosengine | last post by:
Hi all, I wanted to put some common security functions into a class that inherits from the Page class and then use the new class as the basis for all my pages. Unfortunately, if I try and...
8
by: Metro Sauper | last post by:
Why is the default text representation for booleans in C# 'True' and 'False' whereas in xml it is 'true' and 'false'? It seems like it would make sense to have them both the same. Metro T....
9
by: James Geurts | last post by:
Hey all... I posted this in the vs.net ide group too, but people are not answering, so I figured that it might be more appropriate here. I'm not sure if I'm adding a designer to my code properly. ...
7
by: Martin Schulze | last post by:
Hello, i tried to compose myself a custom usercontrol which is derieved from System.Windows.Forms.UserControl. It contains 2 comboboxes and one textbox (which are also custom controls, but...
7
by: Studio P.M. | last post by:
Dear colleagues, Does anyone have an idea where I could find precise and detailed explanation of each and every statement of the following “Web Form Designer generated code”: #region Web...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
13
by: cj | last post by:
In a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below. #Region " Windows Form Designer...
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
6
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
Yesterday Visual Studio gave me a strange error both at compiletime and at designtime that had no obvious connection to anything I had changed recently. After some effort tracking down the problem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
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,...
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...
0
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 projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.