如何在后台代码给TextMode="Password"的文本框赋值啊,解决后立马给分(急)
因为txtPassword的TextMode="Password",不能直接赋值
所有就用了下面的这段代码,可是也没有用,请高手帮忙:
String hiddenName = "MyHiddenField";
String hiddenValue = "111";
String csname = "ConcatScript";
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
cs.RegisterHiddenField(hiddenName, hiddenValue);
if (!cs.IsStartupScriptRegistered(cstype, csname))
{
System.Text.StringBuilder cstext = new StringBuilder();
cstext.Append("<script type=text/javascript> function DoClick() {");
cstext.Append("document.getElementById('txtPassword').value='" + hiddenValue + "';");
cstext.Append("form1.txtRePassword.value='" + hiddenValue + "';} </");
cstext.Append("script>");
cs.RegisterStartupScript(cstype, csname, cstext.ToString(), false);
}