Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linkbutton server and client events

Posted on 2011-02-18
2
Medium Priority
?
1,097 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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