I have a UIViewController, a button to retrieve data from Sqlite database, puts the data into UITableView. From UITableView, how do I go to another UIViewController upon Row Select of a particular data ?
public class TableSource : UITableViewSource{
UIViewController parentController;
protected string[] tableItems;
protected string cellIdentifier = "TableCell";
public TableSource (UIViewController parentController)
{
this.parentController = parentController;
}
public TableSource (string[] items)
{
tableItems = items;
}
public override int RowsInSection (UITableView tableview, int section)
{
return tableItems.Length;
}
public override UITableViewCell GetCell (UITableView tableview, MonoTouch.Foundation.NSIndexPath indexPath)
{
UITableViewCell cell = tableview.DequeueReusableCell (cellIdentifier);
//if there are no cells to reuse create a new one
if (cell == null)
cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
cell.TextLabel.Text = tableItems [indexPath.Row];
return cell;
}
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
new UIAlertView("Assess Student", tableItems[indexPath.Row], null, "Confirm", null, "Cancel").Show();
tableView.DeselectRow (indexPath, true);
}
}