|
Hi,
how can I change programaticaly the bgColor of my page for example ?
Thanx
|
|
|
|
|
Try using HTML Control and CSS like this:
<script language="VB" runat="server">
Private Sub Page_Load(obj as Object, e as EventArgs)
objBody.Style("background-color")="#cccccc"
End Sub
</script>
<html>
<body id="objBody" runat="server">
<h1>Hello World</h1>
</body>
</html>
Enrico
|
|
|
|
|
Apologies if this is an old question.
My website is hosted on a fairly standard NT setup with ASP (not ASP.net - though I think that is supported as well). The question is, I'd like to permission off a particular area of the web site, how do I do it? I don't have any kind of rights on the box.
The only thing I do have control over is an access db file, and listing the contents of directories. I've looked at the help from my hosts and there doesn't seem to be anything in there
Thanks.
B.
|
|
|
|
|
Barry,
I had met similar problem before. In a hosted environment, we have limited control over securing a portion of the website.
ASP.NET has the solution to secure a folder using setting in web.config, but again some hosting servers only allow web.config file to resides in root folder.
What I did in classic ASP and ASP.NET is to provide login/logout facility to authenticate user. The user credentials are stored in the database. Once the user is authenticated, I stored the authentication info in cookies. Then in the beginning of each web page I want to secure, I call a function to check the cookie and find out whether the current user is authenticated.
This is a hard way but worth to try. If you need some sample codes, just drop me an email.
Enrico
|
|
|
|
|
Enrico,
Thanks for that I've already started doing something similar (when I get the time!) It's only to really protect parts of the site from the casual user so it doesn't have to be perfect!
Thanks,
Barry.
B.
|
|
|
|
|
How can I change the position of controls in my code behind file?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
How can I change the position of controls in my code behind file?
Do you mean the visual position of the HTML elements on the page?
|
|
|
|
|
Paul Watson wrote:
Do you mean the visual position of the HTML elements on the page?
Yes.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
Paul Watson wrote:
Do you mean the visual position of the HTML elements on the page?
Yes.
Ok couple of things (sorry if you know some of this, just going over it to make sure.)
HTML element positioning is not like a Windows app where you can just set the left and top and have it sit wherever you want. By default it is in "flow" mode where each element flows on from the last.
You can however absolutely position elements by using CSS, so overriding the flow behavouir. When you do this to an element it is taken out of the flow of the document and other elements which are not absolutely positioned will act as if that absolute element does not exist when determining their position.
To get an element to position on a left and top basis you need the following CSS styling applied to it: style="position: absolute; top: 100px; left: 100px;"
Also remember that there is a distinct Server side and Client side to a web app. So you cannot have a for loop in the onload event of your ASPX page which moves an element across the page, it won't work as at that point the HTML has not been sent back to the client. You have to use JavaScript on the client-side to do that (or SVG, SMIL etc., but still all on the client-side.)
Of course in your ASPX onload event you can position a control and that position will be displayed to the client. e.g. Label1.top = 20; Label1.left = 20;
In most cases using the CSS method is best and the easiest (and remember rather use a CSS external file rather than the inline style I showed.) However if you need some calculations to determine the position then you can use JavaScript on the client-side or whatever ASP.NET language you choose on the server-side.
If none of the above is what you are looking for, post your code and what you want to do and I can help more
|
|
|
|
|
Thank you Paul.
Paul Watson wrote:
To get an element to position on a left and top basis you need the following CSS styling applied to it: style="position: absolute; top: 100px; left: 100px;"
I use this part and work for me.I find the top and left in the string and change the value of them.So I can change the position.
Paul Watson wrote:
Of course in your ASPX onload event you can position a control and that position will be displayed to the client. e.g. Label1.top = 20; Label1.left = 20;
How can I overriden onload in my ASPX and can I written it in C#?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
How Can I pass TWO parameters two my ASP.NET in Redirect() function? When I put ? in my URL it see all character after it as one parameter.How can I add another one?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Find it out.I have to use &.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I have overriden onload function of body tag in ASP.NET in my aspx.It always load after Page_Load .Is there any event that run before that?I need to do something before Page_Load .
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
What do you need to do that must be done before Page_Load?
The Init function is call before Page_Load
|
|
|
|
|
I want to get clients window size and pass it to sever before page load.I want to set some size and properties of my controls depends on clients browser size,but everythings in code behind first load then java script runs.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Have you looked at HttpRequest.Browser
|
|
|
|
|
Mark Nischalke wrote:
Have you looked at HttpRequest.Browser
Yes .But the client size does not exist there.Are you sure about it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazy,
You are really going to have to go into some detail.
Is this the same function you wanted to write in javascript? There's no way you can run something on the client before you run Page_Load on the server. The server builds the page, sends it along with any Javascript and the browser picks that up and translates it.
What exactly are you trying to do?
Paul
|
|
|
|
|
Mazdak wrote:
I want to get clients window size and pass it to sever before page load.
The best thing I can think of (and there may be a better way) is to have a "hidden" input field on the form of the previous page then use JavaScript to populate it when the button/link is clicked. Then you should be able to pick that up at the server side.
Paul
|
|
|
|
|
Hi, I need to create an CHM Help System file for my application.
I created some HTML files using MS WORD 2000. In these files there are a lot of jpeg images. Some of them are not displayed on the final chm I cannot figure out why .
Can anyone advise please?
Black ghost
|
|
|
|
|
Just do not create HTML files with Word. Word adds a lot of his stuff into HTML. Use the FrontPage instead.
Also check the links in CHM file, try to navigate by yourself to the images, see if they are included in CHM
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
I'm trying to construct a subclass of the ASP.NET DataGrid with
automatical filter functionality. The idea is as follows:
The page that uses the DataGrid uses the SetQuery function to tell the
grid what It's main query is. This happens in the Page_Load and it
splits the query in 2 to seperatie the SELECT ... WHERE clause and the
ORDER BY clause...
The Grid subclass adds an empty row at the top of the row and puts
dynamically created comboboxes in them with all unique values from that
column that come from the query. When the user selects an item form one
of those comboboxes, the grid refreshes itsself by binding the old query
with some self-constructed restrictions...
The PROBLEM is that I can't find the right place to do this 'requery'.
If I put my code in the OnLoad function it's to early, because the
selected value of the combobox isn't known yet. And if I put my code
in the selectedIndexChanged event handler of the dynamically created
combobox, it's to late to bind the grid, because when I do a DataBind
with the new dataset (the dataset is OK!), the old data is still shown
on the screen...
I've been trying to fix this for about 2 days now, but can't get it to
work. It is really important to me that this works, because if it
doesn't, I'm going to have to place filters on every page manually
instead of using this generic solution.
Structured programming vs. chaotic mind boggling
|
|
|
|
|
I have a COM component DLL created in Visual C++/ATL and used on an ASP page. When I make changes and recompile I get a link error saying that it can't open the DLL for writing. The web server still has access to it. How do I stop and restart the web server?
This is on Windows NT4 Workstation + Option Pack.
I vaguely remember that I must do
net stop xxx
net start xxx
Kevin
|
|
|
|
|
net stop IISAdmin
Server will then moan about stopping W3SVC etc.
Once it has stopped everything (if everything goes off without a hitch), then do whatever you want with the DLL, and restart W3SVC etc.
You can also do this using the 'Services' dialog (I think - been a while since I looked at an NT workstation machine).
Cheers
|
|
|
|