Guid premiumRatePK = new Guid(this.grdPremiumRates.DataKeys[e.RowIndex].Value.ToString());Hi,
protected void grdPremiumRates_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataSet dsPremiumRate = (DataSet)Session["dsPremiumRate"]; this.oPremiumRate.Delete(dsPremiumRate, e.RowIndex); this.BindControl(this.grdPremiumRates); }The grid is defined like this:
<mm:mmGridView ID="grdPremiumRates" runat="server" AccessLevel="Full" AutoGenerateColumns="False" BindingSource="PremiumRate" AllowSorting="True" OnSorting="grdPremiumRates_Sort" DataKeyNames="PremiumRatePK"....The problem I am having is that the wrong row is getting deleted. I believe this is due to me displaying the grid sorted. So the e.RowIndex references a row in the sorted grid, but the dataset is not sorted when stored in the Session["dsPremiumRate"]. Is there a way that I can get the Primary Key of the row from the grid view and use that rather than the row index?