TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Claudio Correia
NA
1
0
Custom Web Button
Oct 8 2008 7:08 AM
I've been searching the web for 2 days already for something that could help with my problem, I'm currently developing a custom web button, the requirement for it is to be able to have a image has background, text and a embended image...I've been doing the code for it and it's current state is like this:
#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 = "<table><tr><td><img src='"+this.src+"' alt='Embedded image' /></td><td>"+this.Text+"</td></tr></table>";
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
Reply
Answers (
1
)
Changing user control at runtime?
data grid