Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
COHENMARVIN - 19 Oct 2005 17:11 GMT
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?
S. Justin Gengo - 19 Oct 2005 17:28 GMT
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.aspx',
'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.

Signature

Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
                           Nietzsche

>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
[quoted text clipped - 15 lines]
> stylesheet info that the user entered, using asp.net, and only then
> open a new window.  Is that impossible?
Jason Kester - 20 Oct 2005 02:13 GMT
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/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.