Asp.net dynamic controls from l2e
G'day, I have an aspx page that has its html stored in a sql server 2008 table which uses linq to entities to retrieve & display in a placeholder on the page. This all displays correctly except for an as开发者_StackOverflow社区p button that will not display. Viewing the source of the page shows that the button is there but it is not on the page.
Page = Page.Replace("!LOGINBUTTON!", "< asp:Button id='login' text='Login' runat='server' />")
How do I get it to display?
Thanks.
Whatever code you are replacing with !LOGINBUTTON! is .ASPX code. It is not a pure HTML to display button.
When ASP.net actually render page asp:Button Converted with HTML <Input Type="Button" .....
with appropriate Javascript functions(for postback).
In this case if you want to see button with its postback event you need to write
Page = Page.Replace("!LOGINBUTTON!", "< intput type='Button' id='login' text='Login'/>")
I hope it will work.
精彩评论