bind user controls dynamically in jquery tabs

Posted by Taanu51 under ASP.NET on 1/24/2013 | Points: 10 | Views : 1924 | Status : [Member] | Replies : 0

Please provide me the solution how to bind user controls dynamically in jquery tabs..please note that user control contains update panels


I am trying to create a tab container using jquery.its successfully created.
<div class="content">
<div id="myTabs" style="width: 600px;">
<li><a href="#tab0">one</a></li>
<li><a href="#tab1">two</a></li>
<div id="tab0"></div>

Next,used the jquery ajax to pass the control name

$(function () {

var $tabs = $("#myTabs").tabs({
select: function (e, ui) {
thistab = ui.index;
$("#tab" + thistab).html(getUsercontrol(thistab));

function getUsercontrol(thistab) {
switch (thistab) {
case 0:
userControlName = "ctrlOne.ascx";
case 1:
userControlName = "ctrltwo.ascx";

type: "POST",
url: "frmCLClaims.aspx/GetUserControl",
data: "{controlName:'" + userControlName + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
$("#tab" + thistab).html(result.d);

in aspx.cs page ..created the web method like this

public static string GetUserControl(string controlName)
using (Page page = new Page())
HtmlForm form = new HtmlForm();
UserControl userControl = (UserControl)page.LoadControl("~/PL/Claims/UserControls/" + controlName);
using (StringWriter writer = new StringWriter())
HttpContext.Current.Server.Execute(page, writer, false);
return writer.ToString();

Error raises in this line.

HttpContext.Current.Server.Execute(page, writer, false);

Error : Error executing child request for handler 'System.Web.UI.Page'&quot

Please solve the issue


Tanisha Sayyad
.Net and Android Developer
INDIA(Andhra Pradesh)


(No response found.)

Login to post response