I have a .htm file that shows in an iframe which is part of a master's
asp:Content.
I need the .htm to copy the style class from the master or set it as shown
below.
Below is how I set the stylesheet in the master.
What I'd like to do, is change that code into javascript and run it in the
htm file.
I can change the Select into if...else
But I don't know how to is extract from Session("StyleS heetIndex"); rather
that set it
And all the rest!
Can this be done on javascript?
Can you get me started?
Thanks for any help at all
Session("StyleS heetIndex") = colorIndex
Dim objCSS As HtmlLink = New HtmlLink()
Select Case colorIndex
Case Is = 0, 1
objCSS.Attribut es.Add("href", "App_Themes/Backgroundblack .css") '
Session["Stylesheet "].ToString())
Case Is = 2
objCSS.Attribut es.Add("href", "App_Themes/Backgroundwhite .css")
Case Is = 3
objCSS.Attribut es.Add("href", "App_Themes/Backgroundtextu red.css")
End Select
objCSS.Attribut es.Add("rel", "stylesheet ")
objCSS.Attribut es.Add("type", "text/css")
HeadMaster.Cont rols.Add(objCSS ) 9 2586
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I have an .htm file that shows in an iframe which is part of a master's
asp:Content.
But I don't know how to extract from Session("StyleS heetIndex"); rather
than set it. And all the rest!
Can this be done in JavaScript?
No. JavaScript is client-side - it can't interrogate Session variables
because Session is server-side...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
Isn't there a way around that. Maybe do save something additional when I
save the session varable that will be available on the client side.
What about the rest of the code. Is it possible to convert that to
javascript?
Thanks
Dim objCSS As HtmlLink = New HtmlLink()
Select Case colorIndex
Case Is = 0, 1
objCSS.Attribut es.Add("href", "App_Themes/Backgroundblack .css") '
Session["Stylesheet "].ToString())
Case Is = 2
objCSS.Attribut es.Add("href", "App_Themes/Backgroundwhite .css")
Case Is = 3
objCSS.Attribut es.Add("href", "App_Themes/Backgroundtextu red.css")
End Select
objCSS.Attribut es.Add("rel", "stylesheet ")
objCSS.Attribut es.Add("type", "text/css")
HeadMaster.Cont rols.Add(objCSS )
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:eX******** ******@TK2MSFTN GP02.phx.gbl...
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I have an .htm file that shows in an iframe which is part of a master's asp:Content.
But I don't know how to extract from Session("StyleS heetIndex"); rather than set it. And all the rest!
Can this be done in JavaScript?
No. JavaScript is client-side - it can't interrogate Session variables
because Session is server-side...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
your javascript coudl make an ajax call to get the session value, then add a
css rule, but why bother. why don't you convert the html page to aspx, or map
..htm to asp.net so you can set the theme.
-- bruce (sqlwork.com)
"_Who" wrote:
Isn't there a way around that. Maybe do save something additional when I
save the session varable that will be available on the client side.
What about the rest of the code. Is it possible to convert that to
javascript?
Thanks
Dim objCSS As HtmlLink = New HtmlLink()
Select Case colorIndex
Case Is = 0, 1
objCSS.Attribut es.Add("href", "App_Themes/Backgroundblack .css") '
Session["Stylesheet "].ToString())
Case Is = 2
objCSS.Attribut es.Add("href", "App_Themes/Backgroundwhite .css")
Case Is = 3
objCSS.Attribut es.Add("href", "App_Themes/Backgroundtextu red.css")
End Select
objCSS.Attribut es.Add("rel", "stylesheet ")
objCSS.Attribut es.Add("type", "text/css")
HeadMaster.Cont rols.Add(objCSS )
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:eX******** ******@TK2MSFTN GP02.phx.gbl...
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I have an .htm file that shows in an iframe which is part of a master's
asp:Content.
But I don't know how to extract from Session("StyleS heetIndex"); rather
than set it. And all the rest!
Can this be done in JavaScript?
No. JavaScript is client-side - it can't interrogate Session variables
because Session is server-side...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
[please don't top-post]
>>I have an .htm file that shows in an iframe which is part of a master's asp:Content .
But I don't know how to extract from Session("StyleS heetIndex"); rather than set it. And all the rest!
Can this be done in JavaScript?
No. JavaScript is client-side - it can't interrogate Session variables because Session is server-side...
Isn't there a way around that.
Not while you're using an HTML file. HTML files are not processed by
ASP.NET - they are simply streamed to the client...
Maybe do save something additional when I save the session variable that
will be available on the client side.
I don't know how else to explain this to you - JavaScript runs on the
client. This means it can't interact with the server. Once a piece of
JavaScript has been streamed down to the client browser, the server has no
further control over it...
You could, perhaps, look at saving the Session variable as a cookie and then
retrieving it with javascript : http://www.google.co.uk/search?sourc...aScript+cookie
What about the rest of the code. Is it possible to convert that to
JavaScript?
Server-side code is server-side code and client-side code is client-side
code... You cannot convert from one to the other, as they both run
completely separately one from the other...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:OA******** ********@TK2MSF TNGP04.phx.gbl. ..
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
[please don't top-post]
>>>I have an .htm file that shows in an iframe which is part of a master's asp:Conten t.
But I don't know how to extract from Session("StyleS heetIndex"); rather than set it. And all the rest!
Can this be done in JavaScript?
No. JavaScript is client-side - it can't interrogate Session variables because Session is server-side...
Isn't there a way around that.
Not while you're using an HTML file. HTML files are not processed by
ASP.NET - they are simply streamed to the client...
>Maybe do save something additional when I save the session variable that will be available on the client side.
I don't know how else to explain this to you - JavaScript runs on the
client. This means it can't interact with the server. Once a piece of
JavaScript has been streamed down to the client browser, the server has no
further control over it...
I understand the difference but I figured since the serrver side develops
the HTML it might be able to stuff some data someplace in the HTML. Like
your sugested a cookie. Now I'm familiar with the cookies on disk. But I
gather from your suggesstion below that I can create one on the server that
somehow becomes available on the client. (right?) I'll look into that.
>
You could, perhaps, look at saving the Session variable as a cookie and
then retrieving it with javascript: http://www.google.co.uk/search?sourc...aScript+cookie
>What about the rest of the code. Is it possible to convert that to JavaScript?
I meant, can the following be done using javascript? Seems to me that since
the file Backgroundwhite .css is on the server the answer is no it can not be
done in javascript - but I have little insight in this process and wanted to
check before I gave up trying.
Dim objCSS As HtmlLink = New HtmlLink()
objCSS.Attribut es.Add("href", "App_Themes/Backgroundwhite .css")
objCSS.Attribut es.Add("rel", "stylesheet ")
objCSS.Attribut es.Add("type", "text/css")
HeadMaster.Cont rols.Add(objCSS )
Thanks a lot
>
Server-side code is server-side code and client-side code is client-side
code... You cannot convert from one to the other, as they both run
completely separately one from the other...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"bruce barker" <br*********@di scussions.micro soft.comwrote in message
news:87******** *************** ***********@mic rosoft.com...
your javascript coudl make an ajax call to get the session value, then add
a
css rule, but why bother. why don't you convert the html page to aspx, or
map
.htm to asp.net so you can set the theme.
-- bruce (sqlwork.com)
The following is what I'm dealing with (where MissionSchedule ID is an
iframe).
I prefer that Mission.htm remain an html file but I suppose I could convert
it to an aspx each time it is edited (often).
I looked into reading the mission.htm file and using document.writel n to
insert the text instead of using an iframe but if I understand javascript
does not do file input like that.
I would appreciate a few more words about your suggestions.
thanks
Protected WithEvents frame1 As System.Web.UI.H tmlControls.Htm lGenericControl
Protected Sub RadioButtonMiss ion_CheckedChan ged(ByVal sender As Object,
ByVal e As System.EventArg s) Handles RadioButtonMiss ion.CheckedChan ged
frame1 =
Me.Master.FindC ontrol("Table1" ).FindControl(" TableRow9").Fin dControl("Table CellR9C0").Find Control("MainMa sterDataLeftID" ).FindControl(" MissionSchedule ID")
With frame1
..Attributes("s rc") = "Mission.ht m"
..Attributes("w idth") = "100%"
..Attributes("h eight") = "100%"
End With
End Sub
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:O9******** ******@TK2MSFTN GP02.phx.gbl...
>I don't know how else to explain this to you - JavaScript runs on the client. This means it can't interact with the server. Once a piece of JavaScript has been streamed down to the client browser, the server has no further control over it...
I understand the difference but I figured since the serrver side develops
the HTML it might be able to stuff some data someplace in the HTML.
This applies only to files which ASP.NET processes... Ordinarily, ASP.NET
doesn't process HTML files. Therefore, for HTML files, ASP.NET doesn't
"develop the HTML" - it doesn't do anything to them at all...
your sugested a cookie. Now I'm familiar with the cookies on disk. But I
gather from your suggesstion below that I can create one on the server
that somehow becomes available on the client. (right?) I'll look into
that.
No. ASP.NET can cause cookies to be created, but they are still created on
the client. Cookies can't be created on the server...
>What about the rest of the code. Is it possible to convert that to JavaScript?
I meant, can the following be done using JavaScript?
No it can't.
Seems to me that since the file Backgroundwhite .css is on the server the
answer is no it can not be done in JavaScript
Correct.
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:eM******** ******@TK2MSFTN GP03.phx.gbl...
"_Who" <Ca**********@r oadrunner.comwr ote in message
news:O9******** ******@TK2MSFTN GP02.phx.gbl...
>>I don't know how else to explain this to you - JavaScript runs on the client. This means it can't interact with the server. Once a piece of JavaScript has been streamed down to the client browser, the server has no further control over it...
I understand the difference but I figured since the serrver side develops the HTML it might be able to stuff some data someplace in the HTML.
This applies only to files which ASP.NET processes... Ordinarily, ASP.NET
doesn't process HTML files. Therefore, for HTML files, ASP.NET doesn't
"develop the HTML" - it doesn't do anything to them at all...
>your sugested a cookie. Now I'm familiar with the cookies on disk. But I gather from your suggesstion below that I can create one on the server that somehow becomes available on the client. (right?) I'll look into that.
No. ASP.NET can cause cookies to be created, but they are still created on
the client. Cookies can't be created on the server...
>>What about the rest of the code. Is it possible to convert that to JavaScript?
I meant, can the following be done using JavaScript?
No it can't.
>Seems to me that since the file Backgroundwhite .css is on the server the answer is no it can not be done in JavaScript
Correct.
--
Mark Rae
ASP.NET MVP http://www.markrae.net
Guess that completly covers it. Thanks a lot.
>
I think I have it fixed.
In case anyone else has the same problem.
I read the .html file into a string, change the name of the .css file in
that string, and write then a new .html file.
I still have a few ancilary things to fix but I have changed the stylesheet
successfully.
All at the server.
Thanks for the help This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew V. Romero |
last post by:
At work we have an excel file that contains the list of medications and
their corresponding strengths. I would like to save the excel file as a
text list and paste this list into a javascript function and have JS put
this into an array. Then JS would use this array to create a selection
list which displays only the names of the drugs. When the user
selections one of the drugs, another selection list will be loaded with
the avaiable...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm working on it but not
making much progress. Is there any free code available anywhere? I know it...
|
by: mprocopio |
last post by:
Fellow JavaScripters,
I am looking for code or implementation ideas for converting an integer
variable to a four-byte array. I'm porting some of my code from C#,
where I make use of their BitConverter utility class, but am still
feeling my way around a bit here with JavaScript.
The idea is that each of the four bytes that comprise an integer (I
presume numeric types in JavaScript are/can be made four bytes?) are
extracted, and then...
|
by: CSharpener |
last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C#
In JavaScript, it goes like this for an int:
javascript:(123).toString(2
or
javascript:(0xFE).toString(2
No problem. So, how do I do the same in C#? What simple thing am I missing
|
by: rishabhshrivastava |
last post by:
Hello All,
How can I convert a value to Double in JavaScript??? In vbscript i
believe its done as
cDbl(Value)
I tried lots of way but getting a value of "NaN".
Any suggestions/ideas will be truely appreciated.
| |
by: vunet.us |
last post by:
What is the best method to convert milliseconds (after midnight
January 1, 1970 GMT) to formatted time
example:
972798180000 ==10/18/2000 14:08:11
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does 1+1 equal 11? or How do I convert a
string to a number?
-----------------------------------------------------------------------
Javascript variables are loosely typed: the conversion between a
string and a number happens automatically. Since plus (+) is also
used as in string concatenation, ` '1' + 1 ` is equal to ` '11' `: the
String deciding...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does 1+1 equal 11? or How do I convert a
string to a number?
-----------------------------------------------------------------------
Javascript variables are loosely typed: the conversion between a
string and a number happens automatically. Since plus (+) is also
used as in string concatenation, ` '1' + 1 ` is equal to ` '11' `: the
String deciding...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - Why does 1+1 equal 11? or How do I convert a
string to a number?
-----------------------------------------------------------------------
Variables are not typed; their values are. The conversion between a
string and a number happens automatically. Since plus (` + `) is
also used as in string concatenation, ` '1' + 1 ` is equal to ` '11' `.
The string...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |