开发者

TemplateField HeaderText ASP

开发者 https://www.devze.com 2023-04-07 23:16 出处:网络
I want HeaderText to be displayed only when Edit Mode is active <asp:TemplateField> <EditItemTemplate>

I want HeaderText to be displayed only when Edit Mode is active

   <asp:TemplateField>
     <EditItemTemplate>
         <asp:FileU开发者_运维技巧pload ID="fileUploadControl" runat="server" />
     </EditItemTemplate>
   </asp:TemplateField>

I don't have Insert Template And I want header text to be displayed in only during edit mode


One way to do so would be to subscribe to the RowDataBound (assuming you are using a GridView). Check if a Row is in the Edit state, and update the corresponding header text for the Cell.

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.
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消