开发者

changing regular html button to asp.net button control

I have to keep the formatting the exact same way that I got this static html page but have to add some code to it. Right now, I'm stuck with a regular html submit button and I need to figure out a way to switch it to an asp.net button without ruining the format.

So how do I convert:

<button type="submit"><span><span>Review</span></span><开发者_如何学运维/button>"

To a regular ASP.NET control while keeping the span tags? The button I was hoping had some innerhtml property but it doesn't.


Simply place the following attributes in the button :

runat="server" id="btnSubmit" onserverclick="DoSomething"

and wire it up to the code-behind

protected void DoSomething(object sender, EventArgs e)
{
    Response.Write("Hello world");
}

and it's turned into a server control.


Erm, I trust you are not using inline style attributes.

if thats the case then simply substitute the class atteribute with className.

if you are using inline styles then put them into a style tag and use that style name in the className attribute of the asp.net control.

is this helpful or am i missing something?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜