Hi,
you have two possibilities to achieve your goal. Both options are described below:
A: using event handlerIn your
user control you need to create an event handler:
///<summary>Occurs before data is loaded from the database in the form.</summary>
public delegate void OnButtonClickHandler();
///<summary>OnButtonClick event.</summary>
public event OnButtonClickHandler OnButtonClick;
Then in a button click method yo need to call this event:
protected void Button1_Click(object sender, EventArgs e)
{
if (OnButtonClick != null)
{
OnButtonClick();
}
}
In your web part you need to register above event:
// on markup page is registerd your control
//<%@ Register Src="~/CMSWebParts/Text/nested.ascx" TagName="mycontrol" //TagPrefix="cms" %>
//<cms:mycontrol ID="controlID" runat="server" />
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do not process
}
else
{
this.contolID.OnButtonClick += new CMSWebParts_Text_nested.OnButtonClickHandler(controlID_OnButtonClick);
}
}
And finally you need to implement the event:
void list_OnButtonClick()
{
Response.Write("implement me");
}
B: using one of standard method implemented in each web part. In this example is used ReloadData method.In your
control:
CMSAbstractWebPart abs = this.Parent as CMSAbstractWebPart;
if (abs != null)
{
/// here you can call some general method
abs.ReloadData();
}
In your
web part:
/// <summary>
/// Reloads the control data
/// </summary>
public override void ReloadData()
{
base.ReloadData();
SetupControl();
Response.Write("add your custmo code");
}
Best regards,
Ivana Tomanickova