Источник:
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