I'm starting to work with interfaces and I really don't understand... The situation is this: there is a webcontrol (called TableControl) which displays a table of items using a repeater. TableControl includes also a line of cursors (first, previous, next, last) that implements paging. The cursors are imported from another webControl (CursorControl). TableControl implements also an interface, in which I declare some method to do paging.
*) CursorControl
public class CursorControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
private string cursor_value;
public string CursorValue
{
get { return cursor_value; }
set { cursor_value = value; }
}
// Called when cursor is clicked.
protected void lnkClick_Command(object sender, CommandEventArgs e)
{
cursor_value = e.CommandArgument.ToString();
}
}
*) TableControl
public partial class TableControl : System.Web.UI.UserControl, IPageableControl
{
protected void Page_Load(object sender, EventArgs e)
{
if(isPostBack)
{
currentPage = CursorControl.CursorValue;
OtherPage(currentPage);
}
}
public int currentPage;
void IPageableControl.OtherPage(int i)
{
if (i == 0)
currentPage = 2;
else if (i == 1 || i == (-1))
currentPage += i;
else
currentPage = 25;
}
}
*) Interface
public interface IPageableControl
{
// Summary:
// Go to page
void OtherPage(int i);
}
When a user clicks on a cursor I pass the value to TableControl, which should start the method OtherPage. But it doesn't work, it says that OtherPage is not in the current context.
How can I access a method of an interface??