如果我理解你想要正確地做什麼,你想在一個網絡的一部分使用TextBoc控制這掩蓋了輸入像一個密碼輸入框。如果這是正確的,你可以做到這一點,如下所示:
public class LukeTestingWebPart : System.Web.UI.WebControls.WebParts.WebPart
{
TextBox txtBox1; //Declare the TextBox control
public LukeTestingWebPart()
{
}
protected override void CreateChildControls()
{
//Create the child control with th text box mode as Password
txtBox1 = new TextBox();
txtBox1.TextMode = TextBoxMode.Password;
Controls.Add(txtBox1);
base.CreateChildControls();
}
protected override void RenderContents(HtmlTextWriter writer)
{
//Render a line of descriptive text and the textbox control
writer.Write("Here is a text box control that can be used to hold a password:<br />");
txtBox1.RenderControl(writer);
}
}
這是呈現在輸入掩碼文本框中的版本簡單的Web部件......
我希望這可以幫助...
謝謝盧克,但我正在尋找類似以上的東西.. – 2011-01-23 19:01:57