How Number should be right alligned in Gridview.

Posted by Pcjoshi under C# on 3/18/2013 | Points: 10 | Views : 1160 | Status : [Member] | Replies : 9
hi, how can Number should be right aligned in grid view in c#.
In my grid their are many columns which contain number and text.
i want Number should be right aligned.
Please provide the solution.




Responses

Posted by: Jayakumars on: 3/18/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

put this code working Fine

<asp:TemplateField HeaderText="Number" ItemStyle-HorizontalAlign ="Right">

mark as Resolved answer if it is useful.

Mark as Answer if its helpful to you

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pcjoshi on: 3/18/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
I am talking about C# and not a particular column .

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/18/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

post your Sample code.

Mark as Answer if its helpful to you

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pcjoshi on: 3/18/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
check screen shot.
 Download source file

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/18/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
are u design this grid using Html table means

use this

<table>
<tr>
<td>Name</td>
<td>Empno</td>
</tr>
<tr>
<td style ="text-align:right;">AAA</td>
<td>123456.25</td>
</tr>
<tr>
<td>BB</td>
<td style ="text-align:right;">150.35</td>
</tr>
</table>

Mark as Answer if its helpful to you

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pcjoshi on: 3/18/2013 [Member] Starter | Points: 25

Up
0
Down
hi,
this comes through dataset in datatable.


Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/18/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Pcjoshi

ok thats rights then after you bind Gridview or Html Table ? so i give that code. if u bind other control let me know



Mark as Answer if its helpful to you

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pcjoshi on: 3/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,
I bind Gridview.

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 3/18/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
pcjoshi

do u bind Gridview so put like this i previously post this code.

<asp:TemplateField HeaderText="Amount" ItemStyle-HorizontalAlign ="Right">
<ItemTemplate>
<asp:Label ID="lblamount" runat="server" Text='<%#Eval("Amount")%>'></asp:Label></ItemTemplate>
<ItemStyle Width ="30%" />
</asp:TemplateField>


Mark as Answer if its helpful to you

Pcjoshi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response