Protected Sub DeleteFuncObjDetails(ByVal sender As Object, ByVal e As EventArgs) lblobjerrmsg.Visible = False lblperwtfactmsg.Visible = False lblwtfactmsg.Visible = False If GridViewMBOFuncObjDetalis.Rows.Count <> 0 Then Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) Dim con As New SqlConnection(strConnString) Dim cmd As New SqlCommand() cmd.CommandType = CommandType.Text cmd.CommandText = "delete from MBO_Details where " & _ "id=@idnum;" & _ "select id, MBO_FUNC_OBJ, MBO_MEASURED_VAR, MBO_DEADLINE,MBO_WEIGHT_FACT from MBO_Details where MBO_EMP_CODE='" & (EMP_NO) & "'" cmd.Parameters.Add("@idnum", SqlDbType.VarChar).Value = lnkRemove.CommandArgument GridViewMBOFuncObjDetalis.DataSource = GetDataMBOFuncObjDetails(cmd) GridViewMBOFuncObjDetalis.DataBind() End If Dim Conn As New SqlConnection(strConnString) Dim sum As Double = 0.0 Dim Comm1 As New SqlCommand("select MBO_WEIGHT_FACT from MBO_Details where MBO_EMP_CODE='" & EMP_NO & "'", Conn) Conn.Open() Dim DR1 As SqlDataReader = Comm1.ExecuteReader() While DR1.Read() Dim member As String = DR1("MBO_WEIGHT_FACT").ToString() sum = sum + Convert.ToDouble(member) End While txtfuncwttotal.Text = sum BindDataMBOFuncObjDetails() End Sub
Quote:Why are you calling BindDataMBOFuncObjDetails() at last as you have already done the binding above that? One more thing, debug your code by attaching break points on the 2nd Grid's Events and see if they are getting hit while you delete in Grid 1.
BindDataMBOFuncObjDetails()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)