2
Answers

dynamic creation of password in C# code behind

Photo of Ashok

Ashok

7y
818
1
how can i create a password field instead of textbox field.Thank you
 
case "TextBox":
ctl = new System.Web.UI.WebControls.TextBox();
this.AppendEvent(ctl, ci.EventHandler);
break;
case "Password":
ctl = new System.Web.UI.WebControls.TextBox();
this.AppendEvent(ctl, ci.EventHandler);
break;

Answers (2)

0
Photo of Nithya Narashiman
489 2.8k 4.7k 7y
You can set "type" using Attributes Property.
 
ctl.Attributes["type"] = "password";
 
https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.attributes(v=vs.110).aspx
https://stackoverflow.com/questions/48200055/how-to-set-text-of-a-textbox-with-type-password-in-code-behind
Accepted
0
Photo of Ashok
NA 507 85.7k 7y
Tq u Nitya Its working