I make a simple Visual web part and deployed it, and put it on a page. I have a button included in the web part, I want to output some text, like Hello World, output somewhere in SharePoint, so I can do some code tracing when I need to. I assume there is a method for the button, that is called when I click it? It is there that I want to put some code to output text. How is this done in C# code in a web part in SharePoint 2010?
views:
11answers:
1
A:
You can create an event handler for your button by double-clicking it. To display some text in a webpart, just add a label and set its text property.
protected void MyButton_Click(object sender, EventArgs e)
{
MyLabel.Text = "Hello World!";
}
Of course, you could also just use the debugger in Visual Studio if you want to debug something. ;-)
Tom Vervoort
2010-08-06 21:57:14