Click here to Skip to main content
16,019,768 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i had create usercontrol of gridview pager in that i had create dropdown of page size for that i handle delegate event but when Create Delegate Refrence its always return null so plaese help me asap thanx in advance
Posted
Comments
[no name] 30-Jul-11 2:03am    
Post your relevant code here.
bhargavpp 30-Jul-11 7:35am    
public partial class Control_WebUserControl : System.Web.UI.UserControl
{
PageChangedEventHandler PageChanged ;//geting null here

public delegate void PageChangedEventHandler(object sender, CustomPageChangeArgs e);

public virtual void OnPageChanged(CustomPageChangeArgs e)
{
// If an event has no subscribers registerd, it will
// evaluate to null. The test checks that the value is not
// null, ensuring that there are subsribers before
// calling the event itself.

if (PageChanged != null)
{
//point the refrence to PageChanged Method
PageChanged(this, e);
}
}

void Pager_PageChanged(object sender, CustomPageChangeArgs e)
{
if (PageChanged != null)
PageChanged(sender, e);
//throw new Exception("The method or operation is not implemented.");
}

protected void ddlPageNumber_SelectedIndexChanged(object sender, EventArgs e)
{
CustomPageChangeArgs args = new CustomPageChangeArgs();
args.CurrentPageSize = Convert.ToInt32(this.ddlPageSize.SelectedItem.Value);
args.CurrentPageNumber = Convert.ToInt32(this.ddlPageNumber.SelectedItem.Text);
args.TotalPages = Convert.ToInt32(this.lblTotalNumberOfPages.Text);
Pager_PageChanged(this, args);

lblTotalNumberOfPages.Text = string.Format(" {0} ", args.TotalPages.ToString());
}

in desgin page

<asp:DropDownList ID="ddlPageNumber" runat="server" CssClass="DropDown" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageNumber_SelectedIndexChanged">


please check comment where i getting error
Sergey Alexandrovich Kryukov 1-Aug-11 3:00am    
What is "delegate event"? There is no such thing. There are delegate types, delegate instances (they are not of delegate types) and events. What is "Create Delegate Reference"? There is no such thing.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900