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

Button won't center

5 Answers 116 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 19 Aug 2009, 05:05 PM
I am using a form decorator and I can't get my button to center. Here is my code.
    <table width="350px">
        <tr>
            <td>
                <center>
                    <span class="adminTableLabel">Description</span>
                    <asp:TextBox ID="descInput" runat="server" Height="100px" Width="200px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="descValidator" ControlToValidate="descInput"></asp:RequiredFieldValidator>
                </center>
            </td>
        </tr>
        <tr>
            <td>
                <center>
                    <span class="adminTableLabel"></span>
                    <asp:Button ID="addEvent" runat="server" Text="Add" />
                    <br />
                    <asp:Label ID="output" Text="" runat="server"></asp:Label>
                </center>
            </td>
        </tr>
    </table>
When I take out the form decorator it centers fine. I'm sure it has something to do with the css the form decorator uses. How can I center this button? Thanks,

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 20 Aug 2009, 06:44 AM
Hello,

I ran your code with and without RadFormDecorator, but I don't see difference in the position of the button (see attached screenshot). Could you please open a support ticket and send us a sample page along with all the CSS used in it that reproduces the problem? This will allow us to provide you with the most appropriate solution.


Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Web Services
Top achievements
Rank 2
answered on 20 Aug 2009, 01:23 PM
I ended up nesting it into another table that was centered and that centered the button. Not the best approach but it works. Is there anyway I can access the css that these buttons use from the form decorator. If not access them, is there a way I can override any properties? Here is the code I used in case anyone else has the same problem.

<table width="350px">
        <tr>
            <td>
                <center>
                    <span class="adminTableLabel">Description</span>
                    <asp:TextBox ID="descInput" runat="server" Height="100px" Width="200px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="descValidator" ControlToValidate="descInput"></asp:RequiredFieldValidator>
                </center>
            </td>
        </tr>
        <tr>
            <td>
                
                    <span class="adminTableLabel"></span>
                    <center>
                            <table><tr><td><asp:Button ID="addEvent" runat="server" Text="Add" /></td></tr></table>
                    <br />
                    <asp:Label ID="output" Text="" runat="server"></asp:Label>
                </center>
            </td>
        </tr>
    </table>
0
Georgi Tunev
Telerik team
answered on 21 Aug 2009, 11:51 AM
Hi,

You could use IE Dev Toolbar / Firebug or a similar tool to examine what are the classes applied to a particular element and to override them if needed by using the !important directive.
for example:
.myclass
{
 border: 1px solid red !important;
}




Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Web Services
Top achievements
Rank 2
answered on 21 Aug 2009, 05:45 PM
So I located the css tags it is using. I know I have the correct one because when I added some padding it made the button bigger. However, it still won't center. This is what I am trying

 

.radfdInnerSpan{

 

 

text-align: center !important;

 

 

margin-left: auto;

 

 

margin-right: auto;

 

}
Here is actual html that is generated

<table width="200">
<tbody>
<tr>
</tr>
<tr>
<td>
<center>
<a id="Skinnedctl00_MainContent_addCategory" class="radfdSkinnedFormButton radfd_Web20" href="javascript:void(0)" title="Add">
<span class="radfdOuterSpan">
<span class="radfdInnerSpan">Add</span>
</span>
</a>
<input id="ctl00_MainContent_addCategory" class="radfdRealInputButton" type="submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$MainContent$addCategory", "", true, "", "", false, false))" value="Add" name="ctl00$MainContent$addCategory"/>
<br/>
<span id="ctl00_MainContent_output"/>
</center>
</td>
</tr>
</tbody>
</table>
Any other ideas, I'm left to scratching my head. Thanks,

0
Georgi Tunev
Telerik team
answered on 24 Aug 2009, 10:31 AM
Hi,

To be able to help we need to have a better view over your exact setup and layout. That is why I would like to ask you again to open a support ticket and send us a sample page along with all CSS used in it that reproduces the problem. We will check it and do our best to help.


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
FormDecorator
Asked by
Web Services
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Web Services
Top achievements
Rank 2
Share this question
or