Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Dynamically generated controls + ajax + get html

$
0
0

I need to get the html of a control that is in an update panel. Further, I need to get the html of a control doing a ajax post back and not a ful page post back and the control is dynamically generated.

For dynamically generated controls I simply add the controls in a session variable and then readd them again on each post back.

foreach (var cont in (List<Table>)Session["Listoftables"])

        {

PlaceHolders1.Controls.Add(cont);

        }

 

This works to recreate state for the controls. But I need to get the html PlaceHolders1 doing an ajax post back. But  I cannot get the dynamically generated controls to put the state back in the tables. I am getting the html using the following code:

using (StringWriter sw = newStringWriter())

using (HtmlTextWriter htw = newHtmlTextWriter(sw))

        {

this.PlaceHolders1.RenderControl(htw);

var HTML= sw.ToString();

    }

 

Using this code without an update panel works correctly. With ajax it does not work.

 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>