title: Conditional confirm message for Telerik GridButtonColumn
body: <p>I am new to these technologies. </p>
  
  <p>I have a <code>radgrid</code> listing data sets and the reports associated with each data set. Users can click the delete icon in the <code>GridButtonColumn</code> to delete the report from the database.</p>
  
  <p>If the user deletes the last report associated with the data set, I also want to delete the data set. But i want to throw a different confirmation message if this is the case.</p>
  
  <p>Logic:
  Click Delete > query database > if this is the last report associated with data set, throw message A, else throw message B</p>
  
  <p><strong>ASPX</strong></p>
  
  <pre><code>&lt;telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete"
   ButtonType="ImageButton" ImageUrl="~/Icons/delete.png" AutoPostBackOnFilter="true"
   ConfirmTitle="Delete" ConfirmDialogType="Classic"  
   ConfirmText="Are you sure want to delete the selected report?" /&gt;
  </code></pre>
  
  <p><strong>ASPX.CS</strong></p>
  
  <pre><code>    protected void RadGridUser_ItemCommand(object sender, GridCommandEventArgs e)
  {
      if (e.CommandName == RadGrid.DeleteCommandName)
      {
          GridDataItem dataItem = e.Item as GridDataItem;
          int reportID = Convert.ToInt32(dataItem["reportID"].Text);
          int datasetID = Convert.ToInt32(dataItem["datasetID"].Text);
  
          string countQry = "select * from reportTable where datasetID=" + datasetID;
          DataSet dsCount = DBUtils.ExecuteDataset(countQry);
  
          //delete data if this is the only report left for the data set
          if (dsCount.Tables[0].Rows.Count &lt;= 1)
          {  //set ConfirmText = "Deleting this report will also delete the data set. Do you want to delete the data set?"
             //DELETE DATA
          }
          //set ConfirmText = "Are you sure you want to delete the selected report?"
          //DELETE REPORT
      }
    }
  </code></pre>
  
  <p>Is there a way to query the database and change the ConfirmText based on the query results with this GridButonColumn?</p>