2011-01-22 108 views
1

我的Web部件需要一個在頁面中使用時提供的參數。該參數在文本框中提供,而在頁面中用作Web部件。自定義Web部件參數-Sharepoint 2007

我已經放置了一個文本框,它應該以*****的格式獲取參數作爲密碼。

我該怎麼做。

我已編輯的問題的圖解釋了更多的細節

alt text

密碼被供給作爲外部參數和web部件的展開期間提供。

任何機構都可以幫助我。

盧克非常感謝您提供的答案,但我正在尋找這種輸入。

謝謝

哈日Gillala

回答

1

如果我理解你想要正確地做什麼,你想在一個網絡的一部分使用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部件......

我希望這可以幫助...

+0

謝謝盧克,但我正在尋找類似以上的東西.. – 2011-01-23 19:01:57

相關問題