Y
yer darn tootin
Ahoy,
I have an aspx web page that loads an ascx control that's populated
with various items ( in a datalist ). Select an item and the page
reloads and the datalist now shows the details.
something with just the currently viewed datalist contents in it (
leaving the user to print from the browser ).
But I'm not sure how best to go about it, I've been trying out some
javascript ideas I found here ( I've no idea about js, to be honest )
but with them I get a "'CallPrint' is not a member of
'ASP.ItmDetail_ascx' " error
eg itmdetail.ascx :
<DIV id="divprint">
<asp
ataList id="Datalist2" ..>
asp:button ID="btnPrint" onClick="CallPrint('divPrint');" Runat=Server
/>
itmDetail.ascx.vb :
Page_load
....[snip]
' hide the 'All News' DataList1
Panel1.Visible = True
Panel2.Visible = False
Datalist2.DataSource = dr
Datalist2.DataBind()
dr.Close()
cn.Close()
RegScript()
Private Sub RegScript()
Dim scriptstring As String = "<script language=Javascript>
function CallPrint(strid) { "
scriptstring += "var prtContent =
document.getElementById(strid);"
scriptstring += "var WinPrint =
window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');"
scriptstring +=
"WinPrint.document.write(prtContent.innerHTML);"
scriptstring += "WinPrint.document.close();"
scriptstring += "WinPrint.focus();"
scriptstring += "WinPrint.print();"
scriptstring += "WinPrint.close();"
scriptstring += "prtContent.innerHTML=strOldOne; }"
scriptstring += "</script>"
If (Not Page.IsStartupScriptRegistered("Startup")) Then
Page.RegisterStartupScript("Startup", scriptstring)
End If
End Sub
Not sure whether to pursue this line, I'm doing a lot of cut/paste and
getting highy confised. Are there any other ways to get a pop-up of the
contents of the datalist?
Suggestions welcome,
Thank you,
Bob
I have an aspx web page that loads an ascx control that's populated
with various items ( in a datalist ). Select an item and the page
reloads and the datalist now shows the details.
immediately print the contents of the datalist or maybe pop-upFrom here I want to put a print option in, a button that will either
something with just the currently viewed datalist contents in it (
leaving the user to print from the browser ).
But I'm not sure how best to go about it, I've been trying out some
javascript ideas I found here ( I've no idea about js, to be honest )
but with them I get a "'CallPrint' is not a member of
'ASP.ItmDetail_ascx' " error
eg itmdetail.ascx :
<DIV id="divprint">
<asp
asp:button ID="btnPrint" onClick="CallPrint('divPrint');" Runat=Server
/>
itmDetail.ascx.vb :
Page_load
....[snip]
' hide the 'All News' DataList1
Panel1.Visible = True
Panel2.Visible = False
Datalist2.DataSource = dr
Datalist2.DataBind()
dr.Close()
cn.Close()
RegScript()
Private Sub RegScript()
Dim scriptstring As String = "<script language=Javascript>
function CallPrint(strid) { "
scriptstring += "var prtContent =
document.getElementById(strid);"
scriptstring += "var WinPrint =
window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');"
scriptstring +=
"WinPrint.document.write(prtContent.innerHTML);"
scriptstring += "WinPrint.document.close();"
scriptstring += "WinPrint.focus();"
scriptstring += "WinPrint.print();"
scriptstring += "WinPrint.close();"
scriptstring += "prtContent.innerHTML=strOldOne; }"
scriptstring += "</script>"
If (Not Page.IsStartupScriptRegistered("Startup")) Then
Page.RegisterStartupScript("Startup", scriptstring)
End If
End Sub
Not sure whether to pursue this line, I'm doing a lot of cut/paste and
getting highy confised. Are there any other ways to get a pop-up of the
contents of the datalist?
Suggestions welcome,
Thank you,
Bob