Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one single page in my ASP project, where upon clicking a different link, I retrieve ,from the database, the according HTML and load it. So I have some links, that are sitting in the page at all time (the part of the HTML that is not retrieved from the DB) but in some divs I get the HTML, and in there I also have links, that I'd like to run as ASP LinkButton controls.

This is, f.e., that always stays:

ASP.NET
<div id="mainCenter">
    <asp:Literal ID="ltlContentCenter" runat="server" />
</div>

So in my code behind I have this:

C#
protected void Page_Load(object sender, EventArgs e) {
    ltlContentCenter.Text = getPageCenter("media"); //function that retrieves
    ltlContentSide.Text = getPageSide("media");    // the HTML from the database
}

What I have in the DB, corresponding, is:

ASP.NET
<div class="onCenterSmall">
    <asp:LinkButton ID="LinkButton10" Text="test" CommandArgument="test" OnCommand="loadPage_Command"
                runat="server" />
</div>
<div class="onCenterSmall"></div>
<div class="onCenterSmall"></div>


That chunk of HTML just gets put in between the
HTML
<div id="mainCenter"><!-- in here --></div>
on the page. And as you can see by yourself I get the result as string. For the HTML code that's fine, but for the
ASP.NET
<asp:LinkButton...>
that doesn't quite work. Any suggestions how I can do all the work in the same way (or at least to preserve the logic) but to get the LinkButton control working ?
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900