asp.net 3 commonly used functions, directly on the code

Source: Internet
Author: User

In the WinForm is very easy to achieve, press ENTER to perform related functions, textchanged events, and to obtain physical path, in the asp.net to achieve a bit of trouble, such articles more, but the code is more chaotic, special will I use this part of the code posted.

Allow the textbox to detect KeyPress, implement input and then enter.

In addition, to implement text changed to empty another textbox content, found that focus left the first textbox to clear the second textbox, so instead of the first textbox to get focus, empty the second textbox, All of this code is posted as follows (and code that gets the physical path): <textarea cols= "rows=" name= "code" class= "C-sharp" >public partial class Viewfourconer:portalmodulebase, iactionable {string m_applicationpath = ""; String mbtxtpath = ""; protected void Page_Load (object sender, EventArgs e) {try {m_applicationpath = Request.applicationpath; if (this.m_appli Cationpath = = "") This.m_applicationpath = "/"; if (!this.m_applicationpath.endswith ("/")) This.m_applicationpath + = "/"; First Judge/Mbtxtpath = Server.MapPath (M_applicationpath + "DESKTOPMODULES/FOURCONER/MB"); Input. Attributes.Add ("OnKeyPress", "Entertextbox ('" + Button1.clientid + ")"); Input. Attributes.Add ("onfocus", "cleartextbox" + output. ClientID + "')"); if (! IsPostBack) {}} catch (Exception ex) {exceptions.processmoduleloadexception (this, ex);}} Other unrelated method is not posted.}</textarea>

<mce:script language= "javascript" ><!--function Entertextbox (button) {if (Event.keycode = =) {Event.keycode = 9; Event.returnvalue = false; Document.all[button].click (); } function Cleartextbox (textbox) {document.all[textbox].value= "";}//--></mce:script>

These articles are good to talk about new things like using workflows in asp.net.

Http://www.codeproject.com/KB/aspnet/LINQCustomProfileProvider.aspx
Http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx
Http://www.codeproject.com/KB/ajax/Web20Portal.aspx

Note that the JS code.
Please put "Mce:script"
Replace with "script"
There is a problem with the CSDN code feature

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.