Custom Webpart Parameters-Sharepoint 2007
My Webpart needs a parameter which will b开发者_JAVA百科e supplied during the use in a page. The Parameter are supplied in the textbox while its being used in a page as web part.
I have placed a textbox and it should get the parameter as a password in the format of *****.
How can I do that.
I have edited the question The diagram explains in more details
The Password is supplied as an external parameter and supplied during the deployment of the webpart.
Could any body help me.
Luke many thanks for the answer you have provided but I am looking for this kind of input.
Thank You
Hari Gillala
If i have understood what you are wanting to do correctly, you would like to use a TextBoc control in a web part which masks the input like a password input box.. If this is correct you can achieve this as follows:
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);
}
}
This is a ver simple web part that renders a text box where the input is masked...
I hope this helps...
精彩评论