///
/// Code to get Field from Grid. Mallik
///
///
///
///
static AxBoundField GetField(DataControlFieldCollection fields, string name)
{
foreach (DataControlField field in fields)
{
// Is this the field being searched for?
AxBoundField boundField = field as AxBoundField;
if (boundField != null && String.Compare(boundField.DataField, name, true) == 0)
{
return boundField;
}
}
// Nothing found, so return null.
return null;
}
--------------------------------------------------------------------------------------------------------------------------
The following example uses the method created above to set the ReadOnly property for the SalesQty bound field in the AxGridView1 grid object for an AxForm.
-------------------------------------------------------------------------------------------------------------------------
AxBoundField RelatedSalesQty;
AxBoundField RelatedSalesUnit;
try
{
row = this.GetCurrentRow;
authorizationStatus = row.GetFieldValue("AvaAuthorizationStatus").ToString();
if (authorizationStatus == "0")//Labels.GetLabel("@AVA114"))
{
AxGridView1.AllowEdit = true;
AxGridView1.AllowDelete = true;
AxGridView1.AutoGenerateEditButton = true;
RelatedSalesQty = GetField(AxGridView1.Columns, "SalesQty");
RelatedSalesQty.ReadOnly = false;
RelatedSalesUnit = GetField(AxGridView1.Columns, "SalesUnit");
RelatedSalesUnit.ReadOnly = false;
//AxGridView1.Columns.Contains("SalesQty")
ret = true;
}
/// Code to get Field from Grid. Mallik
///
///
///
///
static AxBoundField GetField(DataControlFieldCollection fields, string name)
{
foreach (DataControlField field in fields)
{
// Is this the field being searched for?
AxBoundField boundField = field as AxBoundField;
if (boundField != null && String.Compare(boundField.DataField, name, true) == 0)
{
return boundField;
}
}
// Nothing found, so return null.
return null;
}
--------------------------------------------------------------------------------------------------------------------------
The following example uses the method created above to set the ReadOnly property for the SalesQty bound field in the AxGridView1 grid object for an AxForm.
-------------------------------------------------------------------------------------------------------------------------
AxBoundField RelatedSalesQty;
AxBoundField RelatedSalesUnit;
try
{
row = this.GetCurrentRow;
authorizationStatus = row.GetFieldValue("AvaAuthorizationStatus").ToString();
if (authorizationStatus == "0")//Labels.GetLabel("@AVA114"))
{
AxGridView1.AllowEdit = true;
AxGridView1.AllowDelete = true;
AxGridView1.AutoGenerateEditButton = true;
RelatedSalesQty = GetField(AxGridView1.Columns, "SalesQty");
RelatedSalesQty.ReadOnly = false;
RelatedSalesUnit = GetField(AxGridView1.Columns, "SalesUnit");
RelatedSalesUnit.ReadOnly = false;
//AxGridView1.Columns.Contains("SalesQty")
ret = true;
}
No comments:
Post a Comment