This is a migrated thread and some comments may be shown as answers.

GridButtonColumn ImageButton and text

3 Answers 569 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 21 May 2014, 03:06 PM
When using GridButtonColumn with a ImageButton and text as in below... the text shows up as a tooltip on the image which is fine.. but when exporting to a PDF the text also shows there even though I hide the column. If I change to a button column all works fine.
<telerik:GridButtonColumn ConfirmText="Remove this GCS Security Function?" ConfirmDialogType="RadWindow"
             ConfirmTitle="Remove" CommandName="Delete" Text="Remove this GCS Security Function"
             UniqueName="DeleteColumn" ButtonType="ImageButton">
</telerik:GridButtonColumn>

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
       if (e.CommandName == RadGrid.ExportToPdfCommandName)
       {
             RadGrid1.MasterTableView.DetailTables[0].GetColumn("DeleteColumn").Visible = false;
             return;
        }
}






3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 May 2014, 04:09 AM
Hi Ken,

Please try the following code snippet to hide the columns inside detailtable:

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == RadGrid.ExportToPdfCommandName)
   {     
     foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
     {
       if (item.HasChildItems)
       {
         foreach (GridTableView innerDetailView in item.ChildItem.NestedTableViews)
         {
          GridColumn deleteColumn= innerDetailView.GetColumn("DeleteColumn");
          deleteColumn.Visible = false;                        
         }
       }
     }
   }
}

Thanks,
Princy
0
Ken
Top achievements
Rank 1
answered on 22 May 2014, 01:22 PM
Thanks Princy that worked great...
Now a problem with justifying headings to the left..I use this for a mastertable but doesn't does not seem to work for a detail table

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (_bExport && e.Item is GridHeaderItem)
    {
        foreach (TableCell cell in e.Item.Cells)
            cell.Style["text-align"] = "left";
    }
}
0
Radoslav
Telerik team
answered on 27 May 2014, 07:21 AM
Hi Ken,

Could you please verify that you do not have any external css styles which can change the headers' text position? I tried to reproduce the described issue but to no avail. When I use the code snippet from your last reply the header texts are aligned to the left. I am sending you a simple example which demonstrates that. Please check it out and let me know what differs in your case. Additionally on the following link I attached a short video which demonstrates how the example works on my side.

Looking forward for your reply.


Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Ken
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ken
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or