// Pager1 User Control i.e pager.ascx
public event EventHandler UserControlNextButtonClicked; // Events Declarations
public event EventHandler UserControlPreviousButtonClicked;
private void OnUserControlNextButtonClick()
{
if (UserControlNextButtonClicked != null)
{
UserControlNextButtonClicked(this, EventArgs.Empty);
}
}
private void OnUserControlPreviousButtonClick()
{
if (UserControlPreviousButtonClicked != null)
{
UserControlPreviousButtonClicked(this, EventArgs.Empty);
}
}
protected void lnk_Previous_Click(object sender, EventArgs e)
{
OnUserControlPreviousButtonClick();
}
protected void lnk_Next_Click(object sender, EventArgs e)
{
OnUserControlNextButtonClick();
}
public event EventHandler UserControlPreviousButtonClicked;
private void OnUserControlNextButtonClick()
{
if (UserControlNextButtonClicked != null)
{
UserControlNextButtonClicked(this, EventArgs.Empty);
}
}
private void OnUserControlPreviousButtonClick()
{
if (UserControlPreviousButtonClicked != null)
{
UserControlPreviousButtonClicked(this, EventArgs.Empty);
}
}
protected void lnk_Previous_Click(object sender, EventArgs e)
{
OnUserControlPreviousButtonClick();
}
protected void lnk_Next_Click(object sender, EventArgs e)
{
OnUserControlNextButtonClick();
}
-------------------------------------------------------
aspx.cs
//Page Load
protected void Page_Load(object sender, EventArgs e)
{
{
Pager1.UserControlNextButtonClicked += new EventHandler(Pager1_UserControlNextButtonClicked);
Pager1.UserControlPreviousButtonClicked += new EventHandler(Pager1_UserControlPreviousButtonClicked);
Pager1.UserControlPreviousButtonClicked += new EventHandler(Pager1_UserControlPreviousButtonClicked);
}
private void Pager1_UserControlNextButtonClicked(object sender, EventArgs e)
{
// write any code
}
private void Pager1_UserControlPreviousButtonClicked(object sender, EventArgs e)
{
// write any code
}
{
// write any code
}
private void Pager1_UserControlPreviousButtonClicked(object sender, EventArgs e)
{
// write any code
}
No comments:
Post a Comment