# GrapeCity.ActiveReports.PageReportModel.NameValidator.ValidateName

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_PageReportModel_NameValidator_ValidateName_" data-uid="GrapeCity.ActiveReports.PageReportModel.NameValidator.ValidateName*">ValidateName Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_PageReportModel_NameValidator_ValidateName_" data-uid="GrapeCity.ActiveReports.PageReportModel.NameValidator.ValidateName*"></a>
<h4 id="GrapeCity_ActiveReports_PageReportModel_NameValidator_ValidateName_System_String_GrapeCity_ActiveReports_PageReportModel_NameType_" data-uid="GrapeCity.ActiveReports.PageReportModel.NameValidator.ValidateName(System.String,GrapeCity.ActiveReports.PageReportModel.NameType)">ValidateName(string, NameType)</h4>
<div class="markdown level1 summary"><p>Checks report item names to ensure that they are unique, not empty or null, and do not contain invalid characters.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool ValidateName(string name, NameType nameType)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a> value indicating the name to validate.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.ActiveReports.PageReportModel.NameType.html">NameType</a></td>
      <td><span class="parametername">nameType</span></td>
      <td><p>A <a class="xref" href="GrapeCity.ActiveReports.PageReportModel.NameType.html">NameType</a> value indicating whether the name is for a control, dataset, data region, or grouping object.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>value. <code>true</code> if the name is valid; otherwise <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_PageReportModel_NameValidator_ValidateName_System_String_GrapeCity_ActiveReports_PageReportModel_NameType__examples">Examples</h5>
<pre><code class="lang-csharp">var validator = new NameValidator();
bool isValid = validator.ValidateName("ReportItemName", NameType.Control);</code></pre>

</div>
