|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
gridview column alignmentI have a gridview but the alignment doesn't seem to work.
I want to center a button in one column and text in another. The alignment doesn't work for either column. It does pick up the Font-Bold/Italic though. <asp:TemplateField AccessibleHeaderText="Detail" HeaderText="Access Detail" ShowHeader="False" SortExpression="CandidateID"> <ItemTemplate > X<asp:Button ID="btnDetail" runat="server" CausesValidation="false" Text='<%# Eval("CandidateID") %>' OnClick="btnDetail_Click" />Y </ItemTemplate> <ItemStyle HorizontalAlign="Center" Font-Bold="true" Font-Italic="true" /> </asp:TemplateField> <asp:BoundField DataField="ExitDescription" HeaderText="ExitDescription" SortExpression="ExitDescription" ItemStyle-HorizontalAlign="Right" /> Hi Chuck,
I just tried your code, it seems working correctly on my side. I've attached the screenshot for your reference. It might be related other code in your project. You may send me a complate reproducible project for inspecting. Thanks. Sincerely, Walter Wang (waw***@online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. If you are using Outlook Express, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Chuck P wrote:
Show quoteHide quote > I have a gridview but the alignment doesn't seem to work. Code is correct.> I want to center a button in one column and text in another. > The alignment doesn't work for either column. > It does pick up the Font-Bold/Italic though. > > <asp:TemplateField AccessibleHeaderText="Detail" HeaderText="Access Detail" > ShowHeader="False" SortExpression="CandidateID"> > <ItemTemplate > > X<asp:Button ID="btnDetail" runat="server" CausesValidation="false" > Text='<%# Eval("CandidateID") %>' OnClick="btnDetail_Click" />Y > </ItemTemplate> > <ItemStyle HorizontalAlign="Center" Font-Bold="true" > Font-Italic="true" /> > </asp:TemplateField> > > <asp:BoundField DataField="ExitDescription" HeaderText="ExitDescription" > SortExpression="ExitDescription" ItemStyle-HorizontalAlign="Right" /> Maybe problem is caused by incorrect stylesheet. For example, if in spite of your code both column items aligned to the left then look through stylesheet for declaration: td { .... text-align:left; .... } or if some CssClass applied to grid view <... CssClass="gview" ...> look for ".gview td", ".gview tr td", etc.
client-side code
Populate DropDownList w/ GridView Header Text how to render a graphic and other objects in the same page? How to add DataSource to a TreeView programmatically Required Field Validator Click event for GridView? Click event for GridView Nested user controls issue Unable to add web controls or view web controls in IDE VS.NET 2005 ASP.NET Component |
|||||||||||||||||||||||