|
-
Nov 18th, 2002, 10:51 AM
#1
Thread Starter
Frenzied Member
clicking twice for dialog box [RESOLVED]
I'm using this code on the click event to open a print dialog box..
The problem I'm having is, you have to click the button twice before the dialog box will show....Any suggestions?
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
btnPrint.Attributes.Add("onclick", "javaScript:window.print()")
End Sub
Last edited by EyeTalion; Nov 18th, 2002 at 11:28 AM.
-
Nov 18th, 2002, 11:12 AM
#2
Hyperactive Member
you have to do it twice cuz you that attribute isn't added until you click it one. After you click it once then it's added, now you have to click it again then it works. Add the attribute in the Page_Load:
VB Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PrintDialog.Attributes.Add("onClick", "window.print()")
End Sub
Question though, why use a server side control for this, why not just use a regular ol' button? just curious
-
Nov 18th, 2002, 11:26 AM
#3
Thread Starter
Frenzied Member
thanks pvb, that worked.
If I used an HTML button, would that be quicker becasue I wouldn't have to postback?
-
Nov 18th, 2002, 11:35 AM
#4
Hyperactive Member
not sure if it would be noticably faster but it would save you an unneccessary postback.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|