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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.12.2010, 15:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: EP pop-up windows with checkboxes
Источник: http://palleagermark.blogspot.com/20...heckboxes.html
==============

When building pop-up windows with checkboxes it seems like you can't make the pop-up fields with a checkbox as target. When later reading the value of the pop-up field it always returns “on”.

So with checkboxes you must write the value yourself when closing the pop-up window.

Here is an example. First some code from my pop-up parent:
protected void AddChangeInvoiceBlockScript(SetMenuItemPropertiesEventArgs e, DataSetViewRow row)
{
AxUrlMenuItem menuItem = new AxUrlMenuItem(BLOCK_DIALOG);

if (row != null)
{
AxTableContext context = AxTableContext.Create(row.GetTableDataKey(row.DataSetView.Metadata.RootDataSource, null));

menuItem.MenuItemContext = context;

menuItem.RemoveNavigation = true;

e.MenuItem.ClientOnClickScript = this.PopupChangeBlocked.GetOpenPopupEventReference(menuItem);
}
}
And next initialization code and ButtonOK code from my pop-up:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CheckBoxBlock.Focus();

IAxaptaRecordAdapter ledgerJournalTransRecord;
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);

if (webpart.ExternalContext != null)
{
ledgerJournalTransRecord = webpart.ExternalContext.DataKey.GetRecord(this.AxSession);
if (ledgerJournalTransRecord != null)
if ((int)ledgerJournalTransRecord.GetField(LEDGERJOURNALTRANS_WMAPRBLOC) == 1)
CheckBoxBlock.Checked = true;
}
}
}

protected void OkButton_Click(object sender, EventArgs e)
{
try
{
string fieldValueBlock = CheckBoxBlock.Checked ? BLOCK_YES : BLOCK_NO;

// Set the value based on the state of the checkbox
popupChild.SetFieldValue("hiddenBlockField", fieldValueBlock);

// Calling the script for closing the dialog box
this.popupChild.ClosePopup(true, true);
}
catch (Exception ex)
{
AxExceptionCategory exceptionCategory;
// This returns true if the exception can be handled here
if (!AxControlExceptionHandler.TryHandleException(this, ex, out exceptionCategory))
{
// The exception was fatal - in this case re-throw the error
throw;
}
}
}
And finally closing code from my pop-up parent:
void PopupChangeBlocked_PopupClosed(object sender, EventArgs e)
{
// Get the value of the Blocked check box
bool block = this.PopupChangeBlocked.GetFieldValue("hiddenBlockField") == "1" ? true : false;

// Send the value to the dataset, which will handle the update
this.dsWMAprApprovalList.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call("setWMAprBlock", block);

// Clear popup values
this.PopupChangeBlocked.ClearFieldValues();

// Refresh the grid
this.gridWMAprApprovalList.DataBind();
}
You can see another example on how to use checkboxes with pop-ups in the
TSTimesheetDeleteYesNo User Control.

Other resources:
Pop-up Windows on MSDN
AxPopupParentcontrol on MSDN
AxPopupChildControl on MSDN
Solution Monkey "Devlopers Cookbook"


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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics AX Sustained Engineering: Unable to Browse List Pages in EP when running SharePoint 2010 with Windows Server 2008 R2 (64 Bit) Blog bot DAX Blogs 0 29.12.2010 02:16
paruvella: Issues with EP tools, on 64-bit Windows server 2008. Blog bot DAX Blogs 0 03.12.2010 19:11
palleagermark: Data Set lookups on Enterprise Portal (EP) Blog bot DAX Blogs 0 20.12.2009 11:06
palleagermark: Troubleshooting missing EP Development Tools Blog bot DAX Blogs 0 02.07.2009 14:05
Client Axapta 3.0 SP4 и Linux. Как запустить? Daiver DAX: Администрирование 10 28.06.2007 15:59
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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