473,466 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

page layout changes after response.write

Hi everyone,

string script = "";
script += "<script language='javascript'>";
script += "window.open('showdoc.aspx');";
script += "</script>";
Response.Write(script);

After the execution of this code, the layout of my aspx page changes:
the font gets bigger, the datagrid (font, grid) gets bigger, ...

So is there another way to runs a javascript in code.

thanks,

Filip
May 8 '06 #1
4 4141
Have you tried looking up Page.RegisterClientScriptBlock, or Page.
RegisterStartupScript to be used in the code behind?

May 8 '06 #2
The reason that the page changes visually is that the script you write
will end up before the doctype tag. That makes the browser ignore the
doctype, and the page is displayed in quirks mode.

Use Page.RegisterClientScriptBlock or Page.
RegisterStartupScript to add a script to the page as eruth suggested.
Then it will be placed in the code of the page and not before the code.

Filip De Backer wrote:
Hi everyone,

string script = "";
script += "<script language='javascript'>";
script += "window.open('showdoc.aspx');";
script += "</script>";
Response.Write(script);

After the execution of this code, the layout of my aspx page changes:
the font gets bigger, the datagrid (font, grid) gets bigger, ...

So is there another way to runs a javascript in code.

thanks,

Filip

May 8 '06 #3
But I want to call the javascript in my C# code.
Not in my aspx page with a html button.

When I click on an asp button, I have some cod that updates teh database and
the opens a new window.
That's the problem, with the RegisterClientScriptBlock I can't call the
javascript function in C# (I think)
"Göran Andersson" wrote:
The reason that the page changes visually is that the script you write
will end up before the doctype tag. That makes the browser ignore the
doctype, and the page is displayed in quirks mode.

Use Page.RegisterClientScriptBlock or Page.
RegisterStartupScript to add a script to the page as eruth suggested.
Then it will be placed in the code of the page and not before the code.

Filip De Backer wrote:
Hi everyone,

string script = "";
script += "<script language='javascript'>";
script += "window.open('showdoc.aspx');";
script += "</script>";
Response.Write(script);

After the execution of this code, the layout of my aspx page changes:
the font gets bigger, the datagrid (font, grid) gets bigger, ...

So is there another way to runs a javascript in code.

thanks,

Filip

May 8 '06 #4
Of course you can't call a javascript function from C#. The server code
and the client code don't exist at the same time and don't exist on the
same place. But that is not a problem.

If you don't put the javascript commands in a javascript function, they
will be executed when the page loads. Just as they did when you wrote
them out with Response.Write.

Filip De Backer wrote:
But I want to call the javascript in my C# code.
Not in my aspx page with a html button.

When I click on an asp button, I have some cod that updates teh database and
the opens a new window.
That's the problem, with the RegisterClientScriptBlock I can't call the
javascript function in C# (I think)
"Göran Andersson" wrote:
The reason that the page changes visually is that the script you write
will end up before the doctype tag. That makes the browser ignore the
doctype, and the page is displayed in quirks mode.

Use Page.RegisterClientScriptBlock or Page.
RegisterStartupScript to add a script to the page as eruth suggested.
Then it will be placed in the code of the page and not before the code.

Filip De Backer wrote:
Hi everyone,

string script = "";
script += "<script language='javascript'>";
script += "window.open('showdoc.aspx');";
script += "</script>";
Response.Write(script);

After the execution of this code, the layout of my aspx page changes:
the font gets bigger, the datagrid (font, grid) gets bigger, ...

So is there another way to runs a javascript in code.

thanks,

Filip

May 8 '06 #5

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

Similar topics

10
by: Greg Hurlman | last post by:
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession: Response.Write rs("LastName") Response.Write rs("Suffix")...
2
by: Kingdom | last post by:
I have a SelectBoxes.asp page that is working with multiple selection dropdown boxes to extract data and total the selection prices. Tom & Bob were kind enough to give me a big help getting this...
8
by: Bennett Haselton | last post by:
If I create a new C# Web Project in Visual Studio and add this to the Page_Load method for WebForm1: Response.Write("firsttime"); then hitting F5 to debug the project of course shows the...
2
by: Me | last post by:
Is there anyway to control the style/layout of this field? ..NET doesn't generate an ID for it so you can create a style for it or manipulate it in code. I've looked on MSDN etc. but can't...
1
by: Jack | last post by:
Hi, I got a test asp page which connects to Northwind.mdb database. This page pulls all the rows from the Customers table. One column i.e. GoodStatus has been added to the customers table. The...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
6
by: divya | last post by:
I have a page name edit.asp which should expire immediately .The user cannot open this page directly he has to provide a password for entering this page.thus when the user enters edit.asp , it has...
3
by: Andrew Jocelyn | last post by:
Hi I have couple of dropdown controls each with a requiredfieldvalidator. I clear the dropdownlist in the button click event. When the page is rendered the dropdown validator already flags it's...
17
by: jerrydigital | last post by:
Hello, I have an edit user page that allows the user to view their user information and make changes if possible. I have a simple html login page that directs to an asp page called edituser.asp...
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
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...
1
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.