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

Remove | ('pipe' character) that is displayed with Command row in Grid

2 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul J
Top achievements
Rank 1
Paul J asked on 16 Apr 2010, 04:43 PM
So when you set CommandItemDisplay to true, it adds a table row for the command export buttons. well, it also throws in a "pipe" character |, before the buttons. How do I remove this pipe?

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 19 Apr 2010, 06:15 AM

Hello Paul,

I tried following code in order to hide the pipe charactor in the command item.

aspx:

 
    <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataSourceID="SqlDataSource1">  
    <CommandItemSettings ShowExportToExcelButton="true" /> 

c#:

 
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
    {  
        if (e.Item is GridCommandItem)  
        {  
            TableCell parentCell = e.Item.FindControl("ExportToExcelButton").Parent as TableCell;  
            foreach (Control ctrl in parentCell.Controls)  
            {  
                if (ctrl is LiteralControl)  
                {  
                    LiteralControl literal = ctrl as LiteralControl;  
                    literal.Text = literal.Text.Replace("|"" ");  
                }  
            }  
        }  
    } 

Regards,

Shinu.

0
Paul J
Top achievements
Rank 1
answered on 19 Apr 2010, 04:35 PM
@Shinu, thanks. that code worked.

I had searched the forum up and down for any posts related to 'pipe' and the pipe character '|', but didn't find anything. It wasn't until after I had submitted this post, and a few hours later, that I randomly found a previous posting related to this issue that also provided the same code as you just did.

So my apologies for bringing up a topic previously already addressed and solutioned.

but thanks!
Tags
Grid
Asked by
Paul J
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Paul J
Top achievements
Rank 1
Share this question
or