I've been struggling to position the edit button inside a gridview cell in the top right corner of the cell. The row height varies from row to row so I cannot use CSS height and the inside div does not fill the whole height of the row. Basically I want all the divs inside the template field (td) be the same height as the whole table row (tr). I attached two pics of what I get and what I want. Can someone help?
<asp:TemplateField HeaderText="Префикс GS1" SortExpression="gs1prefix">
<ItemTemplate>
<div style="width:110px;">
<div style="top:0;right:0">
<div style="font-size:0.6em;">
<asp:LinkButton runat="server" ID="lnkEdit2" CommandName="Edit" Text="(Изменить)" />
</div>
</div>
<asp:Label runat="server" Font-Bold="true" ID="lblPartnersGs1Prefix" Text='<%# Eval("gs1prefix") %>' />
</div>
</ItemTemplate>
</asp:TemplateField
What I get:
What I want to get:
UPDATE: Here's generated HTML:
<td align="center" valign="middle">
<div style="width:110px;">
<div style="top:0;right:0">
<div style="font-size:0.6em;">
<a id="ContentPlaceHolder1_gvPartners_lnkEdit2_0" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$gvPartners$ctl02$lnkEdit2','')">(Изменить)</a>
</div>
</div>
<span id="ContentPlaceHolder1_gvPartners_lblPartnersGs1Prefix_0" style="font-weight:bold;">501028410</span>
</div>
</td>
And the stylesheet fragment:
.ColoredGridView{
background-color:white;
}
.ColoredGridView td {
background-color: #9deef1;
border-style: none;
border-width: 0;
padding: 8px;
}
.ColoredGridView td a
{
border-bottom: 1px dotted;
text-decoration-line:none;
}
There are two ways that you could tackle this
<asp:LinkButton runat="server" cssClass="myClass" ID="lnkEdit2" CommandName="Edit" Text="(Изменить)" />
and in your CSS create a class and then position it how you need
or
<asp:LinkButton runat="server" style="text-align: right; vertical-align: top;" ID="lnkEdit2" CommandName="Edit" Text="(Изменить)" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.