473,574 Members | 3,125 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically creating a .js file to be included in response

I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.
Nov 17 '05 #1
10 2725
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag
and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.


Nov 17 '05 #2
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag
and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.


Nov 17 '05 #3
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ev******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.

Nov 17 '05 #4
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ev******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.

Nov 17 '05 #5
Ron,

In case of Http handlers I beleive you'll still have to have an additional
handler file (don't remember its extension) - or at least modify the
application's web.config file to register the handler.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:uD******** *****@TK2MSFTNG P10.phx.gbl...
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ev******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT

tag
and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script. If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the browser that the file does not exsit
Thanks,
Ron.



Nov 17 '05 #6
Ron,

In case of Http handlers I beleive you'll still have to have an additional
handler file (don't remember its extension) - or at least modify the
application's web.config file to register the handler.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:uD******** *****@TK2MSFTNG P10.phx.gbl...
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ev******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT

tag
and generate the script on the fly in this aspx file.

--
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

"Ron Vecchi" <rv*****@xilehd vecchi.com> wrote in message
news:eE******** ******@TK2MSFTN GP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine} .
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script. If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javas cript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javas cript" src="myJavaScri pt.js"></script>
And then dynamically create the file before it returns a response to the browser that the file does not exsit
Thanks,
Ron.



Nov 17 '05 #7
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #8
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #9
Yes, It took me a little while to think through it but since the enum is
known I basically check for it and then create a directory and the .js file
on the server and render my control with the <Script> tag either with the
src attribute pointed to the newly created file or with the tag and
javascript all togeather on the page.

Thanks
"Jacob Yang [MSFT]" <ji***@online.m icrosoft.com> wrote in message
news:Yp******** ******@cpmsftng xa06.phx.gbl...
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #10

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

Similar topics

1
3587
by: Raghuram Banda | last post by:
Hi all, I've created a table with Table Header and the table may or may not contain any rows initially. I've included a .css file in <head> section of my HTML script and I'm creating rows to the table dynamically using JavaScript (using DOM), and the problem is those created bby DOM are not following style sheet rules applicable for table...
0
862
by: Ron Vecchi | last post by:
I am creating a custom web control that uses an enum for a property {Remote,InLine}. If the property is set to inline then text is read from the embedded resource and sent to the browser in the aspx page as inline java script. If the property is set to Remote then the script tag set with the SRC attribute is displayed <script...
2
4555
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is easy, but 1) How do I set about dynamically creating user controls (like TextBox, TextArea) --- simply Declare and initialised (new) the user...
3
2527
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those controls are not present nor their valves in Request.Form.AllKeys.
7
2563
by: andym | last post by:
Dear All, I wish to have an ASP page that displays a predetermined date in the middle of a string. I wish this date to be set in a seperate control panel type page. I am hoping somebody could help me. eg ... A page called "Confirm.asp" has text ... "These prices are valid until 28th Feb 2006". I currently have to go and hard code the...
5
2012
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text = rowDS.Item("Option_Item_Desc") chkCatOption.ID = rowDS.Item("ID").ToString chkCatOption.Checked = rowDS.Item("HasOption")...
0
1368
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes tabpanels such as:Catalog,Terms,SiteMap.ViewCart ,etc. All the jewellery Intro is in the Catalog panel. when I first click the Catalog panel it...
3
4552
by: MLD | last post by:
PLEASE HELP! I would like to include a UL as a menu, styled by an included CSS Style Sheet. The problem I am having is how do I dynamically set the "active" page class using JavaScript to change each time I click on a new list item? I have found a bunch of examples but none that really accomplish what I need.
7
6643
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: ...
0
7726
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8052
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. ...
0
8234
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...
1
7815
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...
0
8098
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...
0
6452
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...
0
3749
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2243
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
1
1339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.