Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Making the same button do client side javascript and server side vbscript?

Reply
Thread Tools

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

 
 
COHENMARVIN
Guest
Posts: n/a
 
      10-19-2005
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?

 
Reply With Quote
 
 
 
 
S. Justin Gengo
Guest
Posts: n/a
 
      10-19-2005
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" <> wrote in message
news: 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?
>



 
Reply With Quote
 
 
 
 
Jason Kester
Guest
Posts: n/a
 
      10-20-2005
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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a client side script Server Side Yonih Javascript 47 12-20-2008 02:16 AM
Button disabled and re-enabled in client side not firing server-side click event. =?Utf-8?B?QmluIFNvbmcsIE1DUA==?= ASP .Net 2 05-27-2008 09:57 AM
How-to? - Process Client-side AND Server-side Code Blocks With aspnet Button Joey ASP .Net 1 01-03-2006 11:01 PM
Calling client side Javascript from a server side button =?Utf-8?B?Qw==?= ASP .Net 1 01-16-2004 05:56 PM
asp:button w/ client side and server side click event Aymer ASP .Net Web Controls 1 09-19-2003 03:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57