HI Friend,
you can create a eventhandler in your user control. and use use that event into your parent control.
So when you click on you button that will fire the parent page event.
For Example:
on my aspx page code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Src="~/userControl.ascx" TagName="UC1" TagPrefix="UC" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
</div>
<div><UC:UC1 ID="uc1" runat="server" önPageTitleUpdated="UC1_PageTitleUpdated" /></div>
</form>
</body>
</html>
my aspx.Cs file code is following.
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void UC1_PageTitleUpdated(object sender, EventArgs e)
{
}
}
Now Ascx, user control code
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="userControl.ascx.cs" Inherits="userControl" %>
<asp:Button ID="submit" runat=server Text="Submit" onclick="submit_Click"/>
and Ascx.vb file code
public partial class userControl : System.Web.UI.UserControl
{
public event EventHandler PageTitleUpdated;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
if (PageTitleUpdated != null)
PageTitleUpdated(sender, e);
}
}
Hope you understood let me know is this solve your problem.