1

I have a silverlight application where users can type in a SQL-query in the application, then the server returns the query result as an Excel file.

Users click on a download link, which is linked to a HttpHandler in the server which generates the excel file. After some research[1] I found out that using the HyperlinkButton control is the most robust way of providing links to file without the hassles of browser's popup security settings.

I need to send the SQL query, which can get quite long, as a parameter to the HttpHandler. I can't include it in the url as querystrings(HTTP GET) due to size limitations.

Is there a way to do a 'HTTP-POST' with HyperlinkButton?

[1] Browser.HtmlPage.Window.Navigate is blocked but HyperlinkButton isn't - why?

Community
  • 1
  • 1
Yeonho
  • 3,629
  • 4
  • 39
  • 61

2 Answers2

3

In that case I think you can try sending a get/post request using jquery.

Post request API documentaton: http://api.jquery.com/jQuery.post/

Get Request API documantation: http://api.jquery.com/jQuery.get/

<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
function f(){
    $.post("http://www.w3schools.com/jquery/demo_test_post.asp",
    {
      name:"Donald Duck",
      city:"Duckburg"
    },
    function(data,status){
      alert("Data: " + data + "\nStatus: " + status);
    }
)};

</script>
</head>
<body>

<a href="javascript:f()">Send an HTTP POST request to a page and get the result back</a>

</body>
</html>
sadaf2605
  • 7,332
  • 8
  • 60
  • 103
0

Instead of Using Links Why just you make the buttons look like Links instead. One perfect example of buttons been shown as links is the Facebook. It has several number of buttons in a post, but all of them are shown as links. Here is the Css Code that what it makes a button look like a link. You can always change the look and feel of the link(perhaps Button).

Here the css code for the button.

button {
    background:none!important;
    border:none; 
    padding:0!important;
    /* Do all your Styling to the Button here. It will look like a link instead. */
}

Button HTML Code.

<button>Your Button Here.</button>

Hope that Solves your Problem. Thank You.

JayKandari
  • 1,228
  • 4
  • 16
  • 33
  • Thanks for your answer. I need to do it inside a Silverlight Application. the reason I'm using HyperlinkButton control is not because of its appearance, but because of the limits of Silverlight framework. – Yeonho Jan 14 '13 at 23:43
  • So do I think I've focused some light on your problem? – JayKandari Jan 15 '13 at 12:47
  • I am developing the application in Silverlight. the UI is not created with HTML/CSS – Yeonho Jan 16 '13 at 02:32