I don't know if all of the WebPart is going to be the default, but it doesn't look right from the documentation, because XmlRoot uses the global definition in this way, and I'm worried that if you use the default, there will be conflicts. , so it's best to keep up with the namespace of the project.
8, then, you can write in the RenderWebPart method of what you want to display.
9. If you want to create some controls on your WebPart, you must call "RenderChildren (Output)" In RenderWebPart, and the following is the program that creates the control:
HtmlButton _mybutton;
HtmlInputText _mytextbox;
Event handler for _mybutton control that sets the
Title to the value in _mytextbox control.
public void _mybutton_click (object sender, EventArgs e)
{
This. Title = _mytextbox. Value;
Try
{
This. Saveproperties=true;
}
Catch
{
Caption = "Error ... Could not save. ";
}
}
Override the asp.net Web.UI.Controls.CreateChildControls
method to create the objects for the Web part ' s controls.
protected override void CreateChildControls ()
{
Create _mytextbox Control.
_mytextbox = new HtmlInputText ();
_mytextbox. Value= "";
Controls.Add (_mytextbox);
Create _mybutton control and wire its event handler.
_mybutton = new HtmlButton ();
_mybutton. innertext = "Set Web part Title";
_mybutton. ServerClick + = new EventHandler (_mybutton_click);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service