AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.09.2009, 15:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Solutions Monkey: Redirecting in EP user control to download a file
Источник: http://blogs.msdn.com/solutions/arch...ad-a-file.aspx
==============
If you have a webpage to generate files such as word doc or pdf and you need to invoke them in a button click event of an user control used in EP and allow the user to download the file through the browser. generally you would think of calling response.redirect function. This function redirects to the download page and since it sets the mime type as the respective file, it prompts the user to save the file to the local machine or open it using the right application. Since AX usercontrols inherently uses AJAX postbacks, the postback progressbar will continue to display "Loading Information" even after the file is downloaded when response.redirect is used. This is because response.redirect supposed to replace the current page displayed in the browser, but in this case it actually streams file and does not replace the currently rendered page in the browser. For such scenarios, instead of using response.redirect, you could execute a client side javascript to push the generated file in a new browser window and avoid the above issue.
X++:
protected void Button1_Click(object sender, EventArgs e)
    {
        AxUrlMenuItem menuItem = new AxUrlMenuItem("EPDocuGet");
        DataSetViewRow row = dsEPCustInvoiceJournalInfo.GetDataSet().DataSetViews[0].GetCurrent();
        AxTableContext context = AxTableContext.Create(row.GetDefaultTableDataKey(row.DataSetView.Metadata.RootDataSource));
        menuItem.MenuItemContext = context;
   
        //Response.Redirect(menuItem.Url.ToString());
 
        string downloadURL = "window.open('" + menuItem.Url.ToString() + "', '_blank', '' );";
        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", downloadURL, true);
 
 
    }


==============
Источник: http://blogs.msdn.com/solutions/arch...ad-a-file.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Solutions Monkey: How to use Chart Control in EP 2009? Blog bot DAX Blogs 0 02.04.2009 09:05
Solutions Monkey: Deploying Ax 2009 SP1 EP Blog bot DAX Blogs 0 05.02.2009 07:08
Solutions Monkey: EP SSL ( https) Setup Blog bot DAX Blogs 0 23.10.2008 12:05
Solutions Monkey: EP Deployment - Internals Blog bot DAX Blogs 0 21.10.2008 20:05
Solutions Monkey: Using Microsoft Dynamics Ax 2009 Workflow controls in EP Blog bot DAX Blogs 0 30.07.2008 10:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 06:56.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.