I've got a pretty simple unigrid setup and all the components are working as expected. I've now got a requirement to hide the "delete" image button and replace it with text. I'm able to hide the button, but not sure how I can return that button instance AND additional text. Do I need to add another action button? If so, how do I make it so its not a ImageButton?
<cms:UniGrid ID="gridBankAccounts" runat="server" ShowActionsMenu="true" RememberDefaultState="true" ShowActionsLabel="false" DisplayMode="Default" OnOnAction="gridBankAccounts_OnAction" OnOnExternalDataBound="gridBankAccounts_OnExternalDataBound">
<GridActions>
<ug:Action Name="deleteaction" Caption="Delete account" Icon="delete.png" ExternalSourceName="checkVisibility" CommandArgument="RS_ACCTCODE" Confirmation="$kt.confirmdelete.bankacct$" />
</GridActions>
<GridColumns>
<ug:Column Source="RS_ACCTDESC" Caption="Nickname" Wrap="false" AllowSorting="true" />
<ug:Column Source="RS_BANKNAME" Caption="Bank Name" Wrap="false" AllowSorting="true" />
<ug:Column Source="DisplayAccountType" Caption="Account Type" Wrap="false" AllowSorting="true" />
<ug:Column Source="RS_BANKACCT" Caption="Account Number" Wrap="false" AllowSorting="true" />
</GridColumns>
<GridOptions ShowSortDirection="true" DisplayPageSizeDropdown="false" />
</cms:UniGrid>
protected object gridBankAccounts_OnExternalDataBound(object sender, string sourceName, object parameter)
{
object param = null;
bool isDelete = false;
if (parameter is System.Web.UI.WebControls.GridViewRow)
{
param = ((System.Web.UI.WebControls.GridViewRow)parameter).DataItem;
}
isDelete = ValidationHelper.GetBoolean(GlobalHelper.IsYes(ValidationHelper.GetString(((System.Data.DataRowView)(param)).Row["RS_DELETE"], "Y")), true);
switch (sourceName)
{
case "checkVisibility": // setting button visibility based on if payments are pending against this account or not
ImageButton btn = (ImageButton)sender;
btn.Visible = isDelete;
// if isDelete, need to hide button and display label or text
return btn;
}
return parameter;
}