Align= "center" effect on data shown gridview rows
Solution 1
Try this:
<RowStyle HorizontalAlign="Center" />
<AlternatingRowStyle HorizontalAlign="Center" />
Solution 2
Set this property in the gridview: RowStyle-HorizontalAlign="Center"
Solution 3
Have a look at the HTML source in your browser. If you see the align="center" in the offline but not in the online version, something went wrong when publishing your web page (or your browser cache needs to be cleaned, see Crimson's answer).
Code Seekers
Reading&Coding Freak! A master in both wasting and utilizing time.. Multi-Tasking by nature..
Updated on July 09, 2022Comments
-
Code Seekers almost 2 years
I am facing a weird situation, I am developing an asp.net website, and I added a gridview control, it is placed inside td tag.
When I ran the website online, I noticed that the data shown on the rows are shifted to the left while their header tags are centered, so I gave the td an
align="center"
property, trying to make the data show centered in each column, and that worked perfectly when debugging the site offline.However, when I ran the site online (after upload), the data still showed shifted (or aligned left).
Am I missing something here?
-
Code Seekers over 14 yearsHtml source showed the align="center" (on the online files :S)
-
Code Seekers over 14 yearsMD5 check shows they r the same files, and i used 3 different browsers till now + empty cache, and firebug to check the code..
-
Code Seekers over 14 yearsi already tried it before :S sadly for some weird reason it is only affecting the alternating rows..(on html check, the table generated to show the grid view has its alternating tr tags with align=center,while the normal tr tags without it, causing a mis-shift
-
Code Seekers over 14 yearsoops my mistake,i was using horizontallaign instead of row style horizontalalign :)
-
Code Seekers over 14 years+1 for suggestions(thx pretty helpful for future testing :) ),and i guess align=center tag on a td ..doesnt enforce itself on the gridview, so i used the property suggested above ..
-
Code Seekers over 14 years+1 for suggestions(thx pretty helpful for future testing :) ),and i guess align=center tag on a td ..doesnt enforce itself on the gridview, so i used the property suggested above ..
-
Chandan Kumar over 9 yearsThanks. You saved my time :)