数据网格列中的居中按钮 [英] Centering button in a datagrid column

查看:48
本文介绍了数据网格列中的居中按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个按钮放在asp.net的datagrid列中,并且它

似乎无法正常工作。


我有以下内容:


< asp:TemplateColumn ItemStyle-Width =" 10%"

ItemStyle-Horizo​​ntalAlign =" Center">

< FooterTemplate>

< asp:LinkBut​​ton CommandName =" Insert" Text ="< img

src =''.. \ images \Add.gif''border =''0''>" ID = QUOT; btnAdd" RUNAT = QUOT;服务器" />

< / FooterTemplate>

< ItemTemplate>

< asp:LinkBut​​ton CommandName ="删除" Text ="< img

src =''.. \ images\Delete.gif''border =''0''>" ID = QUOT; btnDel" RUNAT = QUOT;服务器" />

< / ItemTemplate>

< / asp:TemplateColumn>


我原以为ItemStyle-Horizo​​ntalAlign = QUOT;中心"无论是什么

都在列中 - 这转换为< td>< / td>,但它似乎没有。/ b



有没有办法做到这一点?


谢谢,


Tom

I am trying to center a button in a datagrid column in asp.net and it
doesn''t seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src=''..\images\Add.gif''border=''0''>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src=''..\images\Delete.gif''border=''0''>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center whatever
was in the column - which translates to <td></td>, but it doesn''t seem to do
that.

Is there a way to do this?

Thanks,

Tom

推荐答案

我所做的只是设计CSS ...(并且它可以重复使用)

并添加它像ItemStyle-CssClass = YourCSSClass

GDluck

Patrick


" tshad"写道:
What i do is just design CSS...(And its re usable)
And add it like "ItemStyle-CssClass="YourCSSClass"
GDluck
Patrick

"tshad" wrote:
我试图在asp.net的数据网格列中居中按钮,它似乎无法正常工作。
我有以下内容:

< asp:TemplateColumn ItemStyle-Width =" 10%"
ItemStyle-Horizo​​ntalAlign =" Center">
< FooterTemplate> ;
< asp:LinkBut​​ton CommandName =" Insert" Text ="< img
src =''.. \ images \Add.gif''border =''0''>" ID = QUOT; btnAdd" RUNAT = QUOT;服务器" />
< / FooterTemplate>
< ItemTemplate>
< asp:LinkBut​​ton CommandName ="删除" Text ="< img
src =''.. \ images.\\Delete.gif''border =''0''>" ID = QUOT; btnDel" RUNAT = QUOT;服务器" />
< / ItemTemplate>
< / asp:TemplateColumn>

我原以为ItemStyle-Horizo​​ntalAlign =" Center"将中心列在列中的任何内容 - 这转换为< td>< / td>,但它似乎没有。

是否存在一种方法吗?

谢谢,

Tom
I am trying to center a button in a datagrid column in asp.net and it
doesn''t seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center">
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src=''..\images\Add.gif''border=''0''>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src=''..\images\Delete.gif''border=''0''>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center whatever
was in the column - which translates to <td></td>, but it doesn''t seem to do
that.

Is there a way to do this?

Thanks,

Tom



" Patrick.O.Ige" <帕********* @ discussions.microsoft.com>在消息中写道

新闻:9A ********************************** @ microsof t.com ...
"Patrick.O.Ige" <Pa*********@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com...
我所做的只是设计CSS ...(并且它可以重复使用)
并添加它像ItemStyle-CssClass =YourCSSClass"


我试过了,但我似乎无法找到你说的中心在单元格内的

。有text-align:center和vertical:align但没有

horizo​​ntal-align。 ItemStyle-Horizo​​ntalAlign = QUOT;中心"是什么应该

中心对齐单元格的内容。不知道为什么不起作用。


谢谢,


Tom GDluck
Patrick
tshad写道:
What i do is just design CSS...(And its re usable)
And add it like "ItemStyle-CssClass="YourCSSClass"
I tried that, but I can''t seem to find where you say to center what is
inside the cell. There is text-align:center, and vertical:align but no
horizontal-align. ItemStyle-HorizontalAlign="Center" is what is supposed to
center align the contents of the cell. Not sure why that doesn''t work.

Thanks,

Tom GDluck
Patrick

"tshad" wrote:
我试图在asp.net的数据网格列中居中按钮,它似乎无法正常工作。
我有以下内容:

< asp:TemplateColumn ItemStyle-Width =" 10%"
ItemStyle-Horizo​​ntalAlign =" Center" >
< FooterTemplate>
< asp:LinkBut​​ton CommandName =" Insert" Text ="< img
src =''.. \ images \Add.gif''border =''0''>" ID = QUOT; btnAdd" RUNAT = QUOT;服务器" />
< / FooterTemplate>
< ItemTemplate>
< asp:LinkBut​​ton CommandName ="删除" Text ="< img
src =''.. \ images.\\Delete.gif''border =''0''>" ID = QUOT; btnDel" RUNAT = QUOT;服务器" />
< / ItemTemplate>
< / asp:TemplateColumn>

我原以为ItemStyle-Horizo​​ntalAlign =" Center"会集中在列中的任何
- 转换为< td>< / td>,但它似乎不会那样做。
/>
有办法吗?

谢谢,

Tom
I am trying to center a button in a datagrid column in asp.net and it
doesn''t seem to work.

I have the following:

<asp:TemplateColumn ItemStyle-Width="10%"
ItemStyle-HorizontalAlign="Center" >
<FooterTemplate>
<asp:LinkButton CommandName="Insert" Text="<img
src=''..\images\Add.gif''border=''0''>" ID="btnAdd" Runat="server" />
</FooterTemplate>
<ItemTemplate>
<asp:LinkButton CommandName="Delete" Text="<img
src=''..\images\Delete.gif''border=''0''>" ID="btnDel" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>

I had thought the ItemStyle-HorizontalAlign="Center" would center
whatever
was in the column - which translates to <td></td>, but it doesn''t seem to
do
that.

Is there a way to do this?

Thanks,

Tom





u可以使用ItemStyle-CssClass =" YourCSSClass"

我的意思是创建一个级联样式,然后将其添加到

ItemStyle-CssClass!你做过那个吗?

或者发布你不能居中的代码。

Patrick



***通过开发人员指南 http:// www发送.developersdex.com ***

不要只是参加USENET ......获得奖励!
Hi,
u can use ItemStyle-CssClass="YourCSSClass"
I mean create a Cascading style and then add it to the
ItemStyle-CssClass!Have u done that?
Or post ur code where u can''t center it.
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于数据网格列中的居中按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆