简体   繁体   中英

How to create an Enter button?

I am creating a chat bot. To increase the user friendliness, I need to let the user to press enter button to submit what he typed. I tried few thing. but did not worked.

used default button on the web page.

<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1" Height="414px">

coded the enter button separatly

private void btnEnter_Click(object sender, EventArgs e)
{
    myBot.Read(this.txtInput.Text);
    this.txtInput.Text = string.Empty;
}

I need to do this on a ASP.Net web page. please help.

What does the code for your button look like?

From what you have posted it should look something like this

<asp:Button ID="Button1" Text="Submit" OnClick="btnEnter_Click" runat="server" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM