Hi,
I have a dropdownlist in gridview edit row. The dropdownlist only works when i select any item which ofcourse is the normal behaviour but my requirement is for it to fire with the current value and behaviour once i click edit button.
it should act as if it's a new selection but it should retain current value.
I don't know if i should call it reload or refresh
Below is the dropdown code:
Protected Sub TaxnameDrp_SelectedIndexChanged(sender As Object, e As EventArgs)
        Dim strConnString As String = ConfigurationManager.ConnectionStrings("ConnString").ConnectionString()
        Dim TaxnameDrp As DropDownList = DirectCast(sender, DropDownList)
        Dim TaxName As String = TaxnameDrp.SelectedValue
        ' Get the GridViewRow in which this master DropDownList exists
        Dim row As GridViewRow = DirectCast(TaxnameDrp.NamingContainer, GridViewRow)
        Dim txt As TextBox = DirectCast(row.FindControl("txtTaxamt2"), TextBox)
        Dim stotal As TextBox = DirectCast(row.FindControl("txtSubtotal2"), TextBox)
        Dim strQuery As String = "select TaxID, TaxName, [Rate(%)] from Tax where" & " TaxID = @TaxID"
        Dim con As New SqlConnection(strConnString)
        Dim cmd As New SqlCommand()
        cmd.Parameters.AddWithValue("@TaxID", TaxnameDrp.SelectedItem.Value)
        
        cmd.CommandType = CommandType.Text
        cmd.CommandText = strQuery
        cmd.Connection = con
        Try
            con.Open()
            Dim sdr As SqlDataReader = cmd.ExecuteReader()
            While sdr.Read()
                txt.Text = Convert.ToDecimal(Math.Round(sdr(2).ToString() * stotal.Text.Trim()) / 100).ToString("N2", CultureInfo.CreateSpecificCulture("en-US"))
                hdfTaxName.Value = sdr(2).ToString()
            End While
        Catch ex As Exception
            Throw ex
        Finally
            con.Close()
            con.Dispose()
        End Try
    End Sub
 
Thanks in advance