resi says:
Dim CurrentRow As GridViewRow = TryCast(ctl.NamingContainer, GridViewRow)
Dim thn As Integer = GridView2.DataKeys(CurrentRow.RowIndex)(0)
Dim bln As Integer = GridView2.DataKeys(CurrentRow.RowIndex)(1)
If e.CommandName = "ShowAccount" Then
Dim id As String = e.CommandArgument.ToString
Dim cmd As New SqlCommand()
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim i As Integer = 0
Dim sql As String = Nothing
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "ShowTotalAccount"
cmd.Parameters.Add("@Id", SqlDbType.Int).Value = id
cmd.Parameters.Add("@year", SqlDbType.Int).Value = thn
cmd.Parameters.Add("@month", SqlDbType.Int).Value = bln
adapter = New SqlDataAdapter(cmd)
adapter.Fill(ds)
con.Close()
GridView3.DataSource = ds.Tables(0)
GridView3.DataBind()
ElseIf e.CommandName = "ShowLead" Then
Dim id As String = e.CommandArgument.ToString
Dim cmd As New SqlCommand()
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim i As Integer = 0
Dim sql As String = Nothing
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "ShowTotalLead"
cmd.Parameters.Add("@Id", SqlDbType.Int).Value = id
cmd.Parameters.Add("@year", SqlDbType.Int).Value = thn
cmd.Parameters.Add("@month", SqlDbType.Int).Value = bln
adapter = New SqlDataAdapter(cmd)
adapter.Fill(ds)
con.Close()
GridView3.DataSource = ds.Tables(0)
GridView3.DataBind()
ElseIf e.CommandName = "ShowOwner" Then
Dim id As String = e.CommandArgument.ToString
Dim cmd As New SqlCommand()
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim i As Integer = 0
Dim sql As String = Nothing
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "ShowTotalOwner"
cmd.Parameters.Add("@Id", SqlDbType.Int).Value = id
cmd.Parameters.Add("@year", SqlDbType.Int).Value = thn
cmd.Parameters.Add("@month", SqlDbType.Int).Value = bln
adapter = New SqlDataAdapter(cmd)
adapter.Fill(ds)
con.Close()
GridView3.DataSource = ds.Tables(0)
GridView3.DataBind()
GridView3.DataBind()
ElseIf e.CommandName = "ShowActivity" Then
Response.Write("<script language=javascript>alert('ERROR ShowActivity');</script>")
ElseIf e.CommandName = "ShowDeal"
Response.Write("<script language=javascript>alert('ERROR ShowDeal');</script>")
End If
replace above code with below.