hello.
well, what you can do is get a reference to the placeholder where your user control is being loaded. then you can remove your 1st user control and add the new one.
Thanks a lot. But i can't seem to figure out how to get it to work inside the update panel. Could you plees give a code example?
My best regards
hello.
not suer if this is your scenario, but it should point you in the right direction (as allways, there are other ways of doing this):
user1.ascx
<%@. Control Language="C#" ClassName="user1" %>
<%@. Reference VirtualPath="user2.ascx" %>
<script runat="server">
void handle(object sender, EventArgs args)
{
Page page = this.Page;
Control ctl = page.FindControl("holder");
ctl.Controls.Add(this.LoadControl("user2.ascx"));
ctl.Controls.Remove(this);
}
</script>
<span>user control 1</span>
<asp:Button runat="server" ID="bt" Text="Change to 2" OnClick="handle" />
user2.ascx
<%@. Control Language="C#" ClassName="user2" %>
<script runat="server">
</script>
<span>Control 2</span>
userpage.aspx
<%@. Page Language="C#" %>
<%@. Register src="http://pics.10026.com/?src=~/user1.ascx" TagName="user" TagPrefix="pr" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<atlas:ScriptManager runat="server" ID="manager" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" id="panel">
<ContentTemplate>
<asp:Panel runat="server" ID="holder">
<pr:user runat="server" id="usr" />
</asp:Panel>
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html>
Thanks a lot.
Hi,
I have a similar kind of issue. My user control has a dropdownlist and list box based on the property DisplayControl set , either dropdown list or list box will be displayed in the calling page.
I am placing this user control inside a gridview - Edit item template and Gridview is placed inside an updatePanel. This way control is working fine, but the update becomes really slow (around 5min).
Any suggestion to solve is appreciated.
Thanks and Regards
No comments:
Post a Comment