Got it working eventually used this code:
Deleting:
public delegate void GridViewDeleteEventHandler(Object sender, GridViewDeleteEventArgs e);
void __Dependencies_RowDeleting(Object sender, GridViewDeleteEventArgs e)
{
GridViewRow i = __Dependencies.Rows[e.RowIndex];
int dependancyid = Convert.ToInt32(((Label)i.FindControl("__DependancyId")).Text.ToString());
Vendor.deleteDependancy(dependancyid);
BindData();
}
Paging:
void __Dependencies_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
__Dependencies.PageIndex = e.NewPageIndex;
BindData();
}
This is the HTML part:
<asp:GridView ID="__Dependencies" runat="server" AutoGenerateColumns="False" AllowPaging="True"
PageSize="5" OnRowDeleting="__Dependencies_RowDeleting" OnPageIndexChanging="__Dependencies_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="Vendor Item">
<ItemTemplate>
<asp:Label ID="__DependancyId" runat="server" Visible="false" Text='<%# Bind("id") %>'></asp:Label>
<asp:Label ID="__ItemNumber" runat="server" Text='<%# Bind("itemNumber") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ratio">
<ItemTemplate>
<asp:Label ID="__Ratio" runat="server" Text='<%# Bind("ratio") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
I still want to be able to enable sorting in the GridView any help on this would also be great.