Click here to Skip to main content
15,917,481 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Placeholder+usercontrol Pin
Ramkumar_S25-Aug-09 2:35
Ramkumar_S25-Aug-09 2:35 
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class SampleMenuPage1 : System.Web.UI.Page
{
private const string BASE_PATH = "~/DynamicControlLoading/";

private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}

private void LoadUserControl()
{
string controlPath = LastLoadedControl;
if (!string.IsNullOrEmpty(controlPath))
{
PlaceHolder1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
PlaceHolder1.Controls.Add(uc);
}
}

protected void Page_Load(object sender, EventArgs e)
{
LoadUserControl();

if (IsPostBack)
{
//Sleeps for 1 Seconds
//A Fake Deley to show the UpdateProgress/ModalPopup
System.Threading.Thread.Sleep(1000);
}
}

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{
MenuItem menu = e.Item;

string controlPath = string.Empty;

switch (menu.Text)
{
case "Load Control2":
controlPath = BASE_PATH + "SampleControl2.ascx";
break;
case "Load Control3":
controlPath = BASE_PATH + "SampleControl3.ascx";
break;
default:
controlPath = BASE_PATH + "SampleControl1.ascx";
break;
}

LastLoadedControl = controlPath;
LoadUserControl();
}
}

In SampleControl2.ascx ..Even is not firing for first time(dropdown onchange event)
And !ispostback is not working

Ramkumar

GeneralRe: Placeholder+usercontrol Pin
Charles Crawford25-Aug-09 12:57
Charles Crawford25-Aug-09 12:57 
GeneralRe: Placeholder+usercontrol Pin
Ramkumar_S25-Aug-09 23:01
Ramkumar_S25-Aug-09 23:01 
GeneralRe: Placeholder+usercontrol Pin
Charles Crawford26-Aug-09 15:12
Charles Crawford26-Aug-09 15:12 
Questionhyperlink with imageUrl Pin
Piya B25-Aug-09 2:19
Piya B25-Aug-09 2:19 
AnswerRe: hyperlink with imageUrl Pin
Ramkumar_S25-Aug-09 2:40
Ramkumar_S25-Aug-09 2:40 
AnswerRe: hyperlink with imageUrl Pin
Rhys Jacob25-Aug-09 2:47
Rhys Jacob25-Aug-09 2:47 
QuestionPrevent resending information on refresh Pin
benams25-Aug-09 1:46
benams25-Aug-09 1:46 
AnswerRe: Prevent resending information on refresh [modified] Pin
padmanabhan N25-Aug-09 1:51
padmanabhan N25-Aug-09 1:51 
GeneralRe: Prevent resending information on refresh Pin
benams25-Aug-09 2:04
benams25-Aug-09 2:04 
GeneralRe: Prevent resending information on refresh Pin
padmanabhan N25-Aug-09 2:09
padmanabhan N25-Aug-09 2:09 
GeneralRe: Prevent resending information on refresh Pin
nagendrathecoder25-Aug-09 2:01
nagendrathecoder25-Aug-09 2:01 
AnswerRe: Prevent resending information on refresh Pin
Vasudevan Deepak Kumar25-Aug-09 2:20
Vasudevan Deepak Kumar25-Aug-09 2:20 
AnswerRe: Prevent resending information on refresh Pin
Amit Patel198525-Aug-09 2:21
Amit Patel198525-Aug-09 2:21 
AnswerRe: Prevent resending information on refresh Pin
N a v a n e e t h25-Aug-09 2:25
N a v a n e e t h25-Aug-09 2:25 
GeneralRe: Prevent resending information on refresh Pin
benams25-Aug-09 2:52
benams25-Aug-09 2:52 
GeneralRe: Prevent resending information on refresh Pin
Abhijit Jana25-Aug-09 3:59
professionalAbhijit Jana25-Aug-09 3:59 
AnswerRe: Prevent resending information on refresh Pin
Abhijit Jana25-Aug-09 4:03
professionalAbhijit Jana25-Aug-09 4:03 
AnswerRe: Prevent resending information on refresh Pin
droth1726-Aug-09 5:10
droth1726-Aug-09 5:10 
QuestionASP.Net with Java Script Pin
Amit Patel198525-Aug-09 0:56
Amit Patel198525-Aug-09 0:56 
AnswerRepost - Please ignore Pin
N a v a n e e t h25-Aug-09 1:21
N a v a n e e t h25-Aug-09 1:21 
GeneralRe: Repost - Please ignore [modified] Pin
Amit Patel198525-Aug-09 1:29
Amit Patel198525-Aug-09 1:29 
GeneralRe: Repost - Please ignore Pin
Abhijit Jana25-Aug-09 1:45
professionalAbhijit Jana25-Aug-09 1:45 
GeneralRe: Repost - Please ignore Pin
Amit Patel198525-Aug-09 1:48
Amit Patel198525-Aug-09 1:48 
GeneralRe: Repost - Please ignore Pin
Abhijit Jana25-Aug-09 1:53
professionalAbhijit Jana25-Aug-09 1:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.