Calculate repeater items which is in user control and display it in literal which is in page?
I've a scenario where I want to calculate the no of records in repeater which is in user control and display the count in a literal which is in page(ex default.aspx). How can I achieve开发者_开发问答 this ? I don't wanna use public properties....i want to do it by creating my own custom event.
Any help or suggestion would be highly appreciated.
Thanks, Sumit Arora
Create a property in the user control:
public int NumberOfRecords { get { return myRepeater.Items.Count; } }
Then, in the Page_Load:
countLabel.Text = string.Format("Number of records: {0}", myUserControl.NumberOfRecords);
精彩评论