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

Making the same button do client side javascript and server side vbscript?

I am working on an application where the user enters info into a
multiline textbox. The info is Stylesheet tags that he wants web pages
to use. Basically he would be entering a stylesheet into the textbox,
something like:
================
..link_header{color: #FFFFFF; font-size: 9pt; text-decoration:none;
font-family: Arial; font-weight: bold;}
===================
Then he clicks a PREVIEW button, and a new window pops open with a
sample webpage formatted using the stylesheet he entered into the
textbox. If he is satisfied with that page, he clicks a SAVE button on
the original page.
Now if this were all in asp.net, it would be easy. I could just
capture the stylesheet info, write to a file, and have the new webpage
refer to that file. But the problem comes in opening a new window. It
seems that ASP.NET can't open a new browser window - only client side
javascript can do that. So I would need to first capture the
stylesheet info that the user entered, using asp.net, and only then
open a new window. Is that impossible?

Nov 19 '05 #1
2 1358
Marvin,

Enter the style sheet information, click the button, in the button's click
event save the style sheet information wherever you need to to access it
again be that a database, session variable, etc.

Then also in the button's click event use the RegisterStartupScript method
to place a script on the page at postback that will open the new window:

Page.RegisterStartupScript("OpenWindow", "<script
language='javascript'>window.open('PreviewPage.asp x',
'PreviewWindow');</script>")

RegisterStartupScript sets the javascript to run when the page is loaded
into the client browser. So the window will open when the postback is
completed.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"COHENMARVIN" <co*********@hotmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am working on an application where the user enters info into a
multiline textbox. The info is Stylesheet tags that he wants web pages
to use. Basically he would be entering a stylesheet into the textbox,
something like:
================
.link_header{color: #FFFFFF; font-size: 9pt; text-decoration:none;
font-family: Arial; font-weight: bold;}
===================
Then he clicks a PREVIEW button, and a new window pops open with a
sample webpage formatted using the stylesheet he entered into the
textbox. If he is satisfied with that page, he clicks a SAVE button on
the original page.
Now if this were all in asp.net, it would be easy. I could just
capture the stylesheet info, write to a file, and have the new webpage
refer to that file. But the problem comes in opening a new window. It
seems that ASP.NET can't open a new browser window - only client side
javascript can do that. So I would need to first capture the
stylesheet info that the user entered, using asp.net, and only then
open a new window. Is that impossible?

Nov 19 '05 #2
Just use window.open() on the client. It will hand you back a
reference to the window it opens that you can use to communicate with
that window. The window will also have a reference to its Parent.

You'll have to parse the stylesheet and set the style properties by
hand. No easy task, but certainly doable. This part I know, because I
actually did this for a client last week.

ASP.NET never comes into play, unless you want it to. If so, scrap the
above and just write the .css text straight into your preview.aspx
page.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/

---
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/

Nov 19 '05 #3

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

Similar topics

2
by: Øyvind Isaksen | last post by:
Hi! I have made a function calles "send()". When I click a button, I want the function to be prosessed. This is the code that I have made, but it dont work: <%function send()
3
by: Peter | last post by:
Hello! Please, could anyone say, can one combine javascript and vbscript in same asp page? I am in situation where I must run some code in javascript and some of it in vbscript. Can I change...
3
by: David Shorthouse | last post by:
Hey folks, Not an off-topic posting.....since I was shot-down in an earlier post...this one's legit. How do I go about calling a server-side vbscript within a client-side javascript function?...
2
by: Ivan Samuelson | last post by:
Does anyone know of a book that covers client-side programming in ASP.NET? I have no problem programming on the server-side, but I'm at a loss on the client-side, including how to program either in...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
3
by: William F. Robertson, Jr. | last post by:
My problem is I routinely use both vbscript and javascript (yes, that is a problem in itself) on the same webpage. I feel placing the "javscript:" or "vbscript:" on all my client side events is...
2
by: alan | last post by:
Hi all, I need to pass a variable to the client-side vbscript and when the button is pressed invoke the script (SomeSub()). The problem is, that the "blablabla" appears only after second...
21
by: Ben | last post by:
Hello I have frames set up in an asp.net application and need one frame to refresh another. Seeing as events need to be registered at the time the page is sent from the server, I was wondering...
7
by: Bjorn Sagbakken | last post by:
Hello. There maybe an simple answer to this, but sometimes one get a strange blindness when working intensely on one single problem. I'm using ASP.NET 2003, building pages that include 3 user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.