Solved

Linkbutton server and client events

Posted on 2011-02-18
2
1,095 Views
Last Modified: 2012-08-13
csharp asp.net 4
I have a linkbutton.

On click I insert some values into a database on server but on the client side I need to open a PDF file in a new window.

How can I achieve this?

Wing
0
Comment
Question by:WingYip
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 7

Expert Comment

by:JosephEricDavis
ID: 34925911
There are server side events and client side events for the linkbutton.

<asp:LinkButton runat="server" ID="lnkButton1" OnClick="ServerSideMethod" OnClientClick="ClientSideMethod" Text="Click Me"></asp:LinkButton>

On the Server side you can do any server side processing you need, and then in the OnClientClick attribute, you give it the name of the javascript function you would like to call.  Have that javascript function open your pdf in a new window.
0
 
LVL 7

Accepted Solution

by:
JosephEricDavis earned 500 total points
ID: 34925939
You can use this to help you with your javascript for opening the pdf in a new window.

http://www.pageresource.com/jscript/jwinopen.htm

Instead of an html page for the url you would just pass it the path to the PDF document you would like to have loaded into a new window.

The onclientclick event will fire before the server side event and open the pdf before the parent page refreshes.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question