L
L
LuciFersh2019-01-31 10:25:18
ASP.NET
LuciFersh, 2019-01-31 10:25:18

How to clear asp net input fields?

Good afternoon. I have input fields (textBox's) to send information to a database. But after sending the data remains in the fields. Standard jquery scripts for clearing the form do not work here, and the html form cannot send data to the database. The reset button works, but only until the form is submitted. After sending, it no longer clears the fields. Maybe there is a solution.? Below is the code.
PS written in vb
"

<asp:DropDownList ID="DropDownList1" runat="server">

        <asp:ListItem>умент</asp:ListItem>

        <asp:ListItem>т</asp:ListItem>

        <asp:ListItem>я</asp:ListItem>

        <asp:ListItem>умент</asp:ListItem>

        <asp:ListItem>умент</asp:ListItem>

        <asp:ListItem>Пневматический инструмент</asp:ListItem>

    </asp:DropDownList>

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

    <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

                  

 

 

    <asp:Button ID="Button2" runat="server" Text="Отправить"/>

Sending to the database on any
Public Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim myconnection As SqlConnection
Dim mycommand As SqlCommand
myconnection = New SqlConnection("Data Source=173;Initial Catalog=testreestr ;User ID=sa;Password=mSfz1")
myconnection.Open()
mycommand = New SqlCommand("INSERT INTO NewType2([section],[nameOO],[property],[nameuser], [emailortel] ) values ​​('" & DropDownList1.SelectedValue & "','" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')",myconnection)
mycommand.ExecuteNonQuery()
End Sub

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question