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

First row column is centered, but not subsequent rows

3 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rohn
Top achievements
Rank 1
Rohn asked on 11 Mar 2009, 12:11 AM
I am using a button column to select to edit a detail record. I have set the HorizontalAlign="Center" as shown below. The FIRST row comes out centered, but all subsuquent rows are left justified.

Any ideas why this is not working?

 

<Columns>

 

 

<telerik:GridButtonColumn

 

 

    CommandName="Select" ButtonType="ImageButton"

 

 

    ImageUrl="~/Images/EditInfo.BMP"

 

 

    UniqueName="Select" HeaderText="Edit">

 

 

    <ItemStyle Width="15px" HorizontalAlign="Center" />

 

 

</telerik:GridButtonColumn>

 


3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 11 Mar 2009, 04:51 AM
Hi Rohn,

I tried setting the HorizontalAlign as shown above and it is working well as expected. Can you try setting the same in the code behind and see if it is working for you.

CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
 
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            if (col.UniqueName == "Select") 
            { 
                col.ItemStyle.HorizontalAlign = HorizontalAlign.Center; 
            } 
        } 
         
        
    } 


Thanks
Shinu
0
Rohn
Top achievements
Rank 1
answered on 12 Mar 2009, 06:14 PM
Yes. That works. Thanks

But then, what is the purpose of the <Item Style HorizontalAlign="Center">
0
Shinu
Top achievements
Rank 2
answered on 13 Mar 2009, 03:32 AM
Hi Rohn,

For me setting the HorizontalAlign for the rows in the aspx also works well. I am not sure what is happening on your end. Which version of the Grid are you using? Mine is RadControls for asp.net AJAX(2008.03.1314.20)

Thanks
Shinu
Tags
Grid
Asked by
Rohn
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rohn
Top achievements
Rank 1
Share this question
or