Refrence: https://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxmanager/how-to/load-user-controls
protected void Page_Load(object sender, EventArgs e)
{
//-----pramod
if (this.CurrentControl != string.Empty)
{
LoadMyUserControl(CurrentControl, this.Page);
}
}
protected void Page_Init(object sender, EventArgs e)
{
FunBindCategory();
}
private string CurrentControl
{
get
{
return this.ViewState["CurrentControl"] == null ? string.Empty : (string)this.ViewState["CurrentControl"];
}
set
{
this.ViewState["CurrentControl"] = value;
}
}
private void LoadMyUserControl(string controlName, Control parent)
{
parent.Controls.Clear();
UserControl MyControl = (UserControl)LoadControl(controlName);
string userControlID = controlName.Split('.')[0];
MyControl.ID = userControlID.Replace("/", "").Replace("~", "");
parent.Controls.Add(MyControl);
this.CurrentControl = controlName;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
this.LoadMyUserControl("~/UserControls/BackendModule/SchemeCategory Master/ucSchemeCategory.ascx", this.Page);
string test= drpcategory.SelectedValue;
}
protected void Page_Load(object sender, EventArgs e)
{
//-----pramod
if (this.CurrentControl != string.Empty)
{
LoadMyUserControl(CurrentControl, this.Page);
}
}
protected void Page_Init(object sender, EventArgs e)
{
FunBindCategory();
}
private string CurrentControl
{
get
{
return this.ViewState["CurrentControl"] == null ? string.Empty : (string)this.ViewState["CurrentControl"];
}
set
{
this.ViewState["CurrentControl"] = value;
}
}
private void LoadMyUserControl(string controlName, Control parent)
{
parent.Controls.Clear();
UserControl MyControl = (UserControl)LoadControl(controlName);
string userControlID = controlName.Split('.')[0];
MyControl.ID = userControlID.Replace("/", "").Replace("~", "");
parent.Controls.Add(MyControl);
this.CurrentControl = controlName;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
this.LoadMyUserControl("~/UserControls/BackendModule/SchemeCategory Master/ucSchemeCategory.ascx", this.Page);
string test= drpcategory.SelectedValue;
}
No comments:
Post a Comment