sck10 wrote:
> Hi Steve,
>
> I'm sorry, but you are referring to your last reply, which my reader is not
> showing. Actually, its showing your reply below as the only reply. To
> answer your question, no, I haven't made any progress on this issue...
Here is a re-post of Stevens first reply:
Hello Sck10,
Thank you for posting in ASPNET newsgroup.
As for the ASP.NET page css formatting issue, I've performed some local
test according to your description and I did manage to reproduce the same
behavior(when the new page opened, original page's css formatting get
lost...).
And based on my further test, I think the problem is caused by the approach
you used to register the client-script. In your page, you use
"Response.Write" to output client-script, this is doable, however, not
recommended because "Response.Write" will always output the string/text
before the page's html content, this will make the page output not a valid
html/xhtml document(I think you found the output script block at the top of
the page source when viewing the source in client browser, correct?).
Though IE or other popular browser can correct parse this, this is not
always guaranteed to work. And in this case, the cause the css format not
correctly get resolved.
In stead of using "Response.Write", you can use the "ClientScriptManager"
class provided in asp.net 2.0, you can get it through the Page class's
"ClientScript" property:
#Page.ClientScript Property
http://msdn2.microsoft.com/en-us/lib...ientscript.asp
x
e.g.
===========================
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String
str = "<script language=""javascript""
> >window.open(""PrintPage.aspx?qv01=14&print=printm e"",
""_blank"");</script>"
Page.ClientScript.RegisterStartupScript(Me.GetType (),
"print_script", str)
End Sub
=======================
the clientscriptmanager.xxxx method can ensure those script blocks to be
registered in the proper location in the page body. Also, I've performed
local test and after changed to use the ClientScriptManager( to register
script), the css formatting issue went away.
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)