我是在asp.net开发网站的新手.所以我有一些麻烦了解以下的区别.一个asp:Button和一个输入按钮有什么区别?
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
代码隐藏
protected void Button1_Click(object sender,EventArgs e) { //Do somthing }
<input id="Submit1" type="submit" value="submit" onclick="return Submit1_onclick()" /> <script language="javascript" type="text/javascript"> // <![CDATA[ function Submit1_onclick() { //Do somthing } // ]]> </script>
解决方法
第一个代码是服务器端代码.当您在Webform中添加标签asp:按钮时,asp.net将为您显示一个输入type =“button”,当您单击此按钮时,它将提交一个帖子到同一个页面(这称为回发)和将处理与此按钮相关联的生命周期和asp.net事件.对于每个服务器控件(如TextBoxes(render input type =’text’)),Panels(renders divs),CheckBoxes(render input type =’checkBox’),Labels(render span)等)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。