Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I've added to a webform in my app, a printing subrutine for my gridview.
the function itself is in javascript but I added it to the code behind, like that:

VB
sub printint()

dim sw as new stringwriter()
dim hw as new htmltextwriter(sw)
gvprint.rendercontrol(hw)

dim gridhtml as string
gridhtml=sw.tostring().replace("""","'").replace(system.enviroment.newline,"")
dim sb as new stringbuilder

sb.append("<script type="'text/javascript'>")
sb.append("window.onload=new function(){") 

.....

sb.append("</script>")
clientscript.registerstartupscript(me.[gettype](),"gridprint",sb.tostring())

end sub


I also added to my page_load this :
VB
page.maintainscrollpositiononpostback=true


now, I'm not sure how the first part is related to the next, but since I've added the maintainscroll, I get an error after every time I try to print the gridview.
that's the error:

"microsoft jscript runtime error: object doesnt support this property or method"

it breaks on weresource.axd inside the function "webform_restorescrollposition".

if I press ignore, everything goes right, but ofcourse I don't want the user to see this error every time he wants to print the gridview.

when I remove the line of "maintainscroll.." I don't get the error.

Can you suggest me what to do?
I searched the net but nothing helped until now..

TNX.
Posted
Comments
Mahesh Bailwal 27-Jun-13 10:37am    
You can use try catch in JavaScript, check whether this help.
danait25 1-Jul-13 8:06am    
it didnt help- I saw when I got the error that there was a problem maybe around the "webform_restorescrollposition" in the axd file (Im guessing its a temp file?)
but nothing beside that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900