我希望仅当编辑模式处于活动状态时才显示HeaderText
<asp:TemplateField>
<EditItemTemplate>
<asp:FileUpload ID="fileUploadControl" runat="server" />
</EditItemTemplate>
</asp:TemplateField>我没有插入模板,我只想在编辑模式下显示页眉文本
发布于 2011-09-27 00:15:56
一种方法是订阅RowDataBound (假设您使用的是GridView)。检查行是否处于编辑状态,并更新单元格的相应标题文本。
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowState == DataControlRowState.Edit)
{
grd.HeaderRow.Cells[0].Text = "Upload a File"; // Cell 0 in this case may need to be changed to match your Cell.
}
}https://stackoverflow.com/questions/7557850
复制相似问题