gpt4 book ai didi

html - asp :TextBox change placeholder via . NET代码隐藏

转载 作者:太空狗 更新时间:2023-10-29 15:26:44 26 4
gpt4 key购买 nike

是否可以通过后面的 ASP.NET 代码更改文本框 placeholder?如果是,怎么办?

标记:

<asp:TextBox ID="TXTPassR" runat="server" CssClass="form-control" 
placeholder="Enter password" TextMode="Password"></asp:Textbox>

代码隐藏:

if (Something)
{
//Change placeholder
}

最佳答案

使用Attributes.Add() :

if (Something)
{
TXTPassR.Attributes.Add("placeholder", "Some Text");
}

AttributeCollection.Add Method (String, String): Adds an attribute to a server control's AttributeCollection object.

关于html - asp :TextBox change placeholder via . NET代码隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37348307/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com