This is a migrated thread and some comments may be shown as answers.

RADGrid client binding download link

3 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neo
Top achievements
Rank 1
Neo asked on 10 Nov 2010, 05:51 PM
Hello Telerik Team,

I am having RADgrid in on of the module of my application. In there we have linkbutton by which i have to download document.

So before i implemented client binding it was working on server side by Item command event. but as i have implemented client side binding i m not getting command argument which are given on client side by javascript.

so below is the code running on server side,
 
MemoryStream stream = TheWay.GetDocument("*", Number, "*", "*") as MemoryStream;<br>
 Response.ContentType = contentType ?? "text/plain";<br>
                                Response.AddHeader("Content-Disposition", "attachment;filename=" + attachment.FileName);<br>
                                byte[] buffer = stream.ToArray();<br>
                                stream.Read(buffer, 0, Convert.ToInt32(stream.Length));<br>
                                Response.ClearContent();<br>
                                Response.BinaryWrite(buffer);                                <br>
                                Response.End();   


Now, Can we do this thing in javascript or by web service? I m not sure abt this one.

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 11 Nov 2010, 02:14 PM
Hi Neo,

In order to achieve your scenario, you should attach a client-side event method to the onclick event of the link button and in the event handler use RadAjaxManager's client-side ajaxRequest() method to make a trip to the server and execute the code needed. You can find more information on that at the following help topic:

http://www.telerik.com/help/aspnet-ajax/ajxclientsideapi.html

Hope it helps.

Regards,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Neo
Top achievements
Rank 1
answered on 11 Nov 2010, 03:05 PM
Hello Tsvetoslav,

Thanks for the reply.

I can make web service call from javascript and execute the logic to get document from server 
but i m not sure how i can transfer that on client side in javascript and export that file.

0
Tsvetoslav
Telerik team
answered on 16 Nov 2010, 02:02 PM
Hello Neo,

I am not sure I have correctly understood your scenario. In case that you want to bind the grid to a given file and then export, you are hitting an unsupported scenario.

If, however, by exporting you mean just to be able to download the file when clicking upon the link, here are some guidelines on how to achieve this:
http://www.west-wind.com/weblog/posts/76293.aspx

Regards,
Tsvetoslav
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Neo
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Neo
Top achievements
Rank 1
Share this question
or