I have created a service to create a file in repository.
I want to call the service on Button click to download the file, like DataExport widget does.
Is there any way to do that?
Use the Service GetFileListingWithLinks for this functionality.
This will give you a hyperlink to allow the file to be downloaded.
If it has to look like a button (vs. the Link widget) you can always overlay the Link widget over the top of the Button.
I have already used GetFileListingWithLinks in the Service and it returns downloadLink of the file, the downloadLink is set as SourceURL in the Link Widget, that scenario works perfectly.
But I want to call the Service when user clicks on a Button.
Situation: in my Mashup user sees charts and there is TimeSelector on the chart, I have to call the Service whenever user changes the TimeSelector. In this way a lot of unnecessary files are created. That's why I want to call the Service when user clicks on a Button.
Great! Like I mentioned, you can use the Link Widget overlayed on a Button widget.
Use the TimeSelector Updated event to retrieve the proper link.