081217
Another way is to add style = "display: none;" to the button ;"
Http://topic.csdn.net/u/20081217/15/064c4a7d-8189-4648-a7e1-0d99e60f4c36.html
Another question was raised. To hide the code generated by button. Directly setting it to visible = false is as follows:
- <Input type = "hidden" name = "_ eventvalidation" id = "_ eventvalidation" value = "/wewagka94slagls0blrbspgcnzaq9b96g6xk5qxbfoy1i + k"/>
Therefore, use the following method.
- <Asp: button id = "button1" runat = "server" text = "button" onclick = "button#click" Height = "0px" width = "0px"/>
Someone asked me on the forum today. I tried it and succeeded. The friend gave me a full score. Well, record it and ask again.
Http://topic.csdn.net/u/20081208/09/5f9c15d5-b605-47a3-86f6-aafd09242801.html
Http://topic.csdn.net/u/20081217/13/5293b3a8-2e3b-4268-b433-d26705374270.html? Seed = 554615676
Front-end
- <% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "test_default" %>
- <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <HTML xmlns = "http://www.w3.org/1999/xhtml">
- <Head runat = "server">
- <Title> how to enable ASP. NET to respond to the keyboard </title>
- <SCRIPT type = "text/JavaScript">
- Function entertextbox ()
- {
- If (event. keycode = 13 & document. All ["textbox1"]. value! = "")
- {
- Event. keycode = 9;
- Event. returnvalue = false;
- Document. All ["button1"]. Click ();
- }
- }
- </SCRIPT>
- </Head>
- <Body onkeypress = "Return entertextbox ()">
- <Form ID = "form1" runat = "server">
- <Div>
- <Asp: textbox id = "textbox1" runat = "server"> </ASP: textbox>
- <Asp: button id = "button1" runat = "server" text = "button" onclick = "button#click"/>
- </Div>
- </Form>
- </Body>
- </Html>
Background
- Using system;
- Using system. Data;
- Using system. configuration;
- Using system. collections;
- Using system. Web;
- Using system. Web. Security;
- Using system. Web. UI;
- Using system. Web. UI. webcontrols;
- Using system. Web. UI. webcontrols. webparts;
- Using system. Web. UI. htmlcontrols;
- Public partial class test_default: system. Web. UI. Page
- {
- Protected void page_load (Object sender, eventargs E)
- {
- }
- Protected void button#click (Object sender, eventargs E)
- {
- Response. Write ("Press ENTER ");
- }
- }