You have to Create Event Handler for User control like this
User control code behind
public event EventHandler SaveReport_Click;
protected void BtnSaveReport_Click(object sender, EventArgs e)
{
SaveReport_Click(sender, e);
getReportName = TxtReportName.Text;
}
UserControl.ascx
<asp:Button ID="BtnSaveReport" runat="server" Text="Save Report" Width="95px"
OnClick="BtnSaveReport_Click"/>
base on usercontrol button click fire the normal event to call button click.
Previours we created event handler right.. And we create get and set methord to assign the value for that variable. Call the Global event.
private string getReportName;
public string GetReportName
{
get { return getReportName; }
set { getReportName = value; }
}
aspx Page.
After implement the user controls, based up usercontrols id we can get that global event in our aspx page.
<uc1:reportdownload id="UCISaveReport" runat="server" xmlns:uc1="#unknown" />
and we create one more event handle to call the methord and we get that value.
UCISaveReport.SaveReport_Click += new EventHandler(BtnSaveReport_Click);
aspx.cs code behind
protected void BtnSaveReport_Click(object sender, EventArgs e)
{
SaveReport();
}