Documentation > CMS Template API Library > PublishingArgs > HasArg(String)

HasArg

Returns true if one of the argument names matches the parameter.

public System.Boolean HasArg(String)


Returns

If the arg is present returns <c>true</c>; otherwise <c>false</c>

Parameters

NameDescriptionType
argName The name of the argument to match. System.String

Code Example

C#

Sample:
int search = 1630;
FilterParams filterParams = new FilterParams();
filterParams.Add(AssetPropertyNames.TemplateId, Comparison.Equals, search);    
filterParams.Limit = 10;

if(context.PublishingArgs.HasArg("_sortAlpha"))
{
  filterParams.SortOrder = SortOrder.OrderBy(AssetPropertyNames.Label);
}

List<Asset> list = Asset.Load("/Site/About Us").GetFilterList(filterParams);

Connect with Crownpeak