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

File Down Load

1 Answer 22 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Arvind
Top achievements
Rank 1
Arvind asked on 26 Aug 2011, 08:59 AM
Hi Telerik Team,

   I am Arvind i am working on the rad Ajax manager, I am using rad Read Pane, inside the radPane i have created a HTML table with ID "messageTable" and i have added this Control (messageTable) to AjaxSettings Updated Control , inside the Table i have added a Asp Place Holder, at runtime i am adding LinkButtons to this and also i have added Event handler for this link buttons, My event handler Appears as follows:

protected void lb_Command(object sender, CommandEventArgs e)
        {
            //CreateLinks();

            Response.ContentType = "application/octet-stream";
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName);
                //string aaa = Server.MapPath(spath + fileName);
                Response.TransmitFile(Server.MapPath("~/" + spath + "/" + fileName));
                Response.End();
        }


on clicking the link the event is being fired and it is connecting to data base and getting the required data, after getting data from database , the data that is being retrieved consists of a file (binary data)  when i try to down load the file i am getting the following error as shown in the figure : "Attachment Error.JPG".

Please help me as soon as possible.

Thanks & Regards
N A Chary.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Aug 2011, 09:54 AM
Hello,

<script type="text/javascript">
    function onRequestStart(sender, args)
    {
        if (args.get_eventTarget().indexOf("LinkButton1") >= 0 )
        {
            args.set_enableAjax(false);
        }
    }
</script>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents OnRequestStart="onRequestStart" />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="LinkButton1">
            <UpdatedControls>
 
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

protected void LinkButton1_Click(object sender, System.EventArgs e)
        {
            // your export/import code should come here
        }


Thanks,
Jayesh Goyani
Tags
Ajax
Asked by
Arvind
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or