473,586 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datalist, js function, printing - is innerhtml ignoring <div class="x"> read from SQL db

Here's the scenario: I have a javascript function taking the contents
of a datalist ( content from a SQL db ) and opening it in a new window
to allow the user to print. The pop-up window successfully applies the
formatting from the datalist ( ie the dl's <ItemStyle> properties ),
but ignores any of the formatting 'hard coded' into the SQL data being
returned, eg things like <div class="newpara" >. This in-table
formatting appears OK on the normal web page when the datalist is
loaded, it's just not being kept when the new window for print pops-up.

Any ideas, or workaround?

Private Sub RegPrintScript( )
imgPrint.Attrib utes.Add("oncli ck",
"javascript:Cal lPrint('divPrin t');")

Dim scriptstring As String = "<script language=Javasc ript>
function CallPrint(strid ) { "
scriptstring += "var prtContent =
document.getEle mentById(strid) ;"
scriptstring += "var WinPrint =
window.open('', '','left=100,to p=150,width=600 ,height=500,too lbar=0,scrollba rs=0,status=0') ;"
scriptstring +=
"WinPrint.docum ent.write(prtCo ntent.innerHTML );"
scriptstring += "WinPrint.docum ent.close();"
scriptstring += "WinPrint.focus ();"
scriptstring += "WinPrint.print ();"
scriptstring += "WinPrint.close ();"
scriptstring += "prtContent.inn erHTML=strOldOn e; }"
scriptstring += "</script>"

'Page.RegisterC lientScriptBloc k("clientScript ", scriptstring)

If (Not Page.IsClientSc riptBlockRegist ered("clientScr ipt"))
Then
Page.RegisterCl ientScriptBlock ("clientScript" ,
scriptstring)
End If
End Sub
The datalist is enclosed in a <DIV id="divprint"> </DIV> tag.

Nov 19 '05 #1
2 2950
I've just realised that the various <div class='x'> styling from
datalist items are being ignored too.

<ItemStyle Font-Size="10pt" Font-Names="=Arial" BorderWidth="0p x"
ForeColor="#000 033"
BackColor="Whit e"></ItemStyle>
<ItemTemplate >
<div class="Title">
<%# DataBinder.Eval (Container.Data Item, "Title") %>
</div>

Is this a known issue ( css styles ignored on client side scripting ),
or is my js function incomplete?

Nov 19 '05 #2
in the spirit of goodwill here's how to read in the css page so the div
classes of the datalist are rendered to the pop-up window/for print.

scriptstring += "WinPrint.docum ent.write('<HTM L><Head><LINK
href=""printpag e.css"" type=""text/css""
rel=""styleshee t""></Head><Body>'); "
scriptstring +=
"WinPrint.docum ent.write(prtCo ntent.innerHTML );"
scriptstring += "WinPrint.docum ent.write('</Body></HTML>'); "

Bob

Nov 19 '05 #3

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

Similar topics

13
40680
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person...
4
3552
by: Akbar | last post by:
All, I'm currently using an alt attribute in a div tag to store "keywords" for a function that will show or hide certain div's based on a given keyword. Is there a better (standard) place to put these keywords? Code can be seen at http://www.straffin.com/test/DUdyn2.html . This is just a sample... the real "keywords" (and other...
19
17382
by: CMAR | last post by:
I have the following markup. The problem is that the browser, e.g., IE6, inserts several lines of blank space between the <div> and the following table. Is there a way to minimize that vertical spacing? Thanks, CMA <div class="vlgray">Condition</div> <table cellpadding="0" cellspacing="0">
3
3488
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005 Beta 1, then Beta 2. I was using the <div runat="server"> statement on my projects. Once I placed a <div id="testdiv" runat="server"> within my...
1
8727
by: lwhitb1 | last post by:
I have been trying to load a javascript function from the body onload html tag, but I only want the function to load the first time the page is loaded: I have investigated but haven't found anything that works.. I thought about cookies, but what if the user's disable them? My code: //I want to call the Toggle function below only on the...
1
2417
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is invalid for a strict implementation. <spanis in-line-level and <divis block-level. I don't want to mix up <span> and <div> I'm using an...
5
38996
by: chakradhari.ashish | last post by:
Does anybody know how can I load an html page inside a <div</div> where the content gets update on the onclick even of anchor <a href=> </a>? I googled around and followed some links pointing me that it is possible to use javascript combined with CSS for doing this? Any ideas? Chakra
1
6431
by: msg2ajay | last post by:
hi, i am working on <div> i have to hide some part of the table. I am not able to hide that table part can anybady tell me where is the error. <html> <head> <script type="text/javascript"> function callme(){ document.getElementById("hid").style.visibility="visible"; }
36
5088
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT do so, since this is not part of the specification. How then to you apply styles to entire columns? Surely you don't have to write <td...
0
7912
marktang
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...
0
7839
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...
0
8202
Oralloy
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. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8216
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 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...
0
6614
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2345
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
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.