views:

40

answers:

2

Can i create html helpers in Webforms project like in asp.net mvc? Thanks.

A: 

You just need a static method:

public static string Label(string target, string text)
{
    return String.Format("<label for= '{0}'>{1}</label>",target,text);
}
Paul Creasey
A: 

It won't be as simple as adding a static method if you want to return WebControls. You would have to hook up to the page render.

Tomislav Markovski