【发布时间】:2016-11-21 21:44:36
【问题描述】:
我在 GridView 中有一个名为“Weightage”的列。我在 gridview 之外有一个名为“Total”的文本框,我想将此文本框对齐在 Weightage 列的正下方。
</asp:GridView>
<div>
<span id="q1totalweightage" runat="server">Total<asp:TextBox ID="txtq1totalweightage" runat="server" ></asp:TextBox></span>
</div>
代码背后:
protected void grvGoals_RowDataBound1(object sender, GridViewRowEventArgs e)
{
switch (e.Row.RowType)
{
case DataControlRowType.DataRow:
q1totalweightage.Attributes.Add("style", "margin-left: " + e.Row.Cells[0].Width + "px;");
break;
}
注意:假设由于某种原因我不能将整个文本框放在页脚中。
【问题讨论】: