#Render web control page
protected override void Render(HtmlTextWriter output)
{
HtmlButton button = new HtmlButton();
button.Style.Add("text-align","center");
button.Style.Add("vertical-align", "middle !important");
button.Attributes.Add("runat", "server");
button.InnerHtml = "
| "+this.Text+" |
button.Attributes.Add("onclick","DoPostBack(this.id,'')");
button.Attributes.Add("onserverclick", "teste_OnClick");
button.RenderControl(output);
}
#javascript on the default page
function DoPostBack(element)
{
__doPostBack(element,"");
}
#codebehind default page
void teste_OnClick(object Source, EventArgs e)
{
Span1.InnerHtml = "You clicked Button1";
}
The current issue is that when I click the button, it does the postback but it doesn't fire the method in the codebehind.
Any help with this would be great, since I just hit a huge brick wall with this one.
Thanks
Claudio Correia
Scott LyslePosted Oct 8, 2008, 10:40 PM