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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 16.10.2008, 00:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Solutions Monkey: Disabling Bound Fields through code
Источник: http://blogs.msdn.com/solutions/arch...ough-code.aspx
==============
You can make a bound field as read only or hide the Lookupbutton of the bound field through code in the page load event.

For example

...

AxBoundField boundField = AxGridView1.Columns[i] as AxBoundField;

boundField.ReadOnly = true;

...



or



...

AxBoundField boundField = AxGridView1.Columns[i] as AxBoundField;

boundField.LookupButtonDisplaySettings = LookupButtonDisplaySettings.Never;

...



If they do want to hide the lookup for specific rows, then they should use a template field instead of the AxBoundField. For example ,



In the below code DataSet Name is DemoSet, Table Name is Table1 and FieldName is AccountNum

asp:TemplateField ConvertEmptyStringToNull="False"

HeaderText="" SortExpression="AccountNum">























Code Behind to hide the lookup control conditionally and disable the cell



protected void AxGridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

if (e.Row != null && e.Row.RowType == DataControlRowType.DataRow)

{

/* disable the thrid column which displays accountnum and hide the lookup if the second field value is 1

DataSetViewRow dataRow = (DataSetViewRow)e.Row.DataItem;

bool isInternalProject = dataRow.GetFieldValue("Field2").ToString() == "1";



if (isInternalProject)

{

Control c = e.Row.Cells[2].FindControl("AxLookup1");

if ( c!= null)

c.Visible = false;

e.Row.Cells[2].Enabled = false;

}

}





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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Solutions Monkey: EP Page Life Cycle Blog bot DAX Blogs 0 18.02.2009 08:05
Solutions Monkey: Aggregation in EP Datasets Blog bot DAX Blogs 0 07.10.2008 06:05
Solutions Monkey: Role Center Security Blog bot DAX Blogs 0 28.05.2008 16:05
Solutions Monkey: EP 4.0 Questions Blog bot DAX Blogs 0 28.10.2006 16:40
при построении перекрёстных ссылок выдаётся сообщение об ошибках mmmax DAX: Программирование 10 21.01.2005 12:42

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

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

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