Showing posts with label enabled. Show all posts
Showing posts with label enabled. Show all posts

Saturday, March 24, 2012

Load different content pages in content place holder without refreshing the whole page usi

Hi,

I have built a ajax enabled website, where i have a master page which holds a content placeholder, and two content pages, where one is the home screen and another is a dashboard, a menu is placed in master page , by default home page is made to display, when the menu item dashboard is clicked , the the contentplace holder should load the dashboard page without postbacking the whole page, how to do that through ajax? Pleas help me.....

Its very urgent, I am stucked.....

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...


Luis Abreu:

hello.

i'd say that you cannot do that in your scenario. i'd refactor the site and transform the contents of the main page and the other page in user controls. then, i'd build only one page set its content to one of the user controls...

Hi Luis,

I am new in creating webapplication. I am not able to get what u'r saying.

Plese explin me in details, What is usercontrol ? How does it satisfy my needs?

Please help me. Give me an example, whre they have used user control .....

Thanks in advance


here's an old post that shows how you might change the user controls on an udpate panel:

http://msmvps.com/blogs/luisabreu/archive/2007/02/15/adding-controls-to-an-updatepanel-through-code.aspx

regarding the user control part, well, it's really the easiest way you have to develop a control. i think that if you go to the asp.net site, you'll be able to get lot of info from the quick starts

Wednesday, March 21, 2012

Loading an Atlas enabled UserControl Dynamically. Urgent!

Hello,

I have 2 buttons within an UpdatePanel (for the menu) and another UpdatePanel (for the Content) where I load a control depending of the menu clicked.

MyControl1.ascx and MyControl2.ascx both content an UpdatePanel too.

Default.aspx:

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default"%>

<html>

<headid="Head1"runat="server">

<title></title>

<Atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"/>

</head>

<body>

<formid="form1"runat="server">

<div>

<Atlas:updatepanelid="UpdatePanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

<asp:ButtonID="Button1"runat="server"Text="Button"OnClick="Button1_Click"/>

<asp:ButtonID="Button2"runat="server"Text="Button"OnClick="Button2_Click"/>

</contenttemplate>

</Atlas:updatepanel>

<br/>

<Atlas:updatepanelid="UpdatePanel2"runat="server"mode="Conditional"rendermode="Inline">

<Triggers>

<Atlas:ControlEventTriggerControlID="Button1"EventName="Click"/>

<Atlas:ControlEventTriggerControlID="Button2"EventName="Click"/>

</Triggers>

<contenttemplate>

<asp:PlaceHolderID="PlaceHolder1"runat="server"></asp:PlaceHolder>

</contenttemplate>

</Atlas:updatepanel>

</div>

</form>

</body>

</html>

Default.aspx.cs:

using System;

using System.Text;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

publicpartialclass _Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

protectedoverridevoid OnInit(EventArgs e)

{

base.OnInit(e);

if (Session["ContentControl"] !=null)

{

Control c = LoadControl(Session["ContentControl"].ToString());

PlaceHolder1.Controls.Add(c);

}

}

protectedvoid Button1_Click(object sender,EventArgs e)

{

Session["ContentControl"] ="/MyContent1.ascx";

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

Session["ContentControl"] ="/MyContent2.ascx";

}

}

MyContent1.ascx:

<%@dotnet.itags.org.ControlLanguage="C#"AutoEventWireup="true"CodeFile="MyContent1.ascx.cs"Inherits="MyContent1"%>

<IGI:updatepanelid="Updatepanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

MyContent1

</contenttemplate>

</IGI:updatepanel>

MyContent2.ascx:

<%@dotnet.itags.org.ControlLanguage="C#"AutoEventWireup="true"CodeFile="MyContent2.ascx.cs"Inherits="MyContent2"%>

<IGI:updatepanelid="Updatepanel1"runat="server"mode="Conditional"rendermode="Inline">

<contenttemplate>

MyContent2

</contenttemplate>

</IGI:updatepanel>

My problem is I have to click twice on a button for the Content control to load because the OnInit is executed before theButton1_Click.( the session is not updated yet when the OnInit is executed );

Anybody has an idea to achived this in One Click??

Many Thanks,

Yann

Did anyone every respond to you on this question? I am having the same problem, and I could only solve it (kind of) by using a master page.

I wrapped the ContentPlaceHolder in the master page inside an UpdatePanel, and in my actual page, I put another PlaceHolder for holding my dynamically created user control (or other type of control based on my portal's configuration).

I would like to know if anyone ever answers this, and I would also like to be able to use WebParts in this scenario, which I have NEVER gotten to work with Atlas and dynamic user controls reliably.