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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 05.11.2008, 11:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: EP 2009: Edit a record outside a grid
Источник: http://palleagermark.blogspot.com/20...side-grid.html
==============

Here is what you can do if you want to edit a record that is not part of a grid.





The record needs to be shown through an AxForm control and on this control you can set the "AutoGenerateEditButton" to True to get an Edit/Update and Cancel button automatically added to the form.





Next you may need to add event handlers to these buttons if you want the system to do something special in case these are clicked.





This is how the event handler for update could look, if you want to run an additional action on the DataSet:





private
void AxForm_MyForm_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)


{



if (e.Exception == null)


{



// Run the approval code



this.MyDataSet.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("MYMethodOnTheDataSet");






// Redirect to the list of invoices



AxUrlMenuItem listpage = new
AxUrlMenuItem("MyMenuItem");


Response.Redirect(listpage.Url.OriginalString);


}


}





And here is how the code for the Cancel button could look:





private
void AxForm_MyForm_ItemCommand(object sender, DetailsViewCommandEventArgs e)


{



if (e.CommandName == "Cancel")


{



this.RedirectToPreviousPage();


}


}





The RedirectToPreviousPage method is a method you have to add yourself. It could look like this:


private
void RedirectToPreviousPage()


{



// Return to the previous page displayed.



if (!String.IsNullOrEmpty(AxWebSession.GetPreviousURL(this.Page)))


{


Response.Redirect(AxWebSession.GetPreviousURL(this.Page));


}



else


{



// The previous page is not available, so return to a known page.



// Use the URL Web Menu item from the AOT to specify which



// page will be displayed.



AxUrlMenuItem listpage = new
AxUrlMenuItem("MyMainPage");


Response.Redirect(listpage.Url.OriginalString);


}


}








And finally you must add you new event handler to the event handlers for the two buttons. This is done in the Page_Init method:





protected
void Page_Init(object sender, EventArgs e)


{



this.AxForm_MyForm.ItemUpdated += new
DetailsViewUpdatedEventHandler(AxForm_MyForm_ItemUpdated);



this.AxForm_MyForm.ItemCommand += new
DetailsViewCommandEventHandler(AxForm_MyForm_ItemCommand);


}



Источник: http://palleagermark.blogspot.com/20...side-grid.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Solutions Monkey: Deploying Ax 2009 SP1 EP Blog bot DAX Blogs 0 05.02.2009 07:08
palleagermark: Bug in EP 2009 when having the debug flag set to true Blog bot DAX Blogs 0 05.01.2009 11:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Solutions Monkey: Using Microsoft Dynamics Ax 2009 Workflow controls in EP Blog bot DAX Blogs 0 30.07.2008 10:05
epblog: UX Guidelines for EP 2009 Blog bot DAX Blogs 0 29.07.2008 04:09
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра
Комбинированный вид Комбинированный вид

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

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

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