C # foreground background code Interaction

Source: Internet
Author: User

Today, I have nothing to worry about. Just bask in what I learned from the project recently. The key point is to feel that these things have been used before, but they will not be able to learn and use them. As a result, they are almost forgotten when necessary.

 

1) eval binding

You can bind a separate field eval ("houseid ")

You can also bind a function <% # houseedit (eval ("infotype"), Eval ("houseid") %>

 

2) Bind

The difference between the two: the eval method is a static one-way (read-only) method, so the eval function is used for one-way (read-only) binding. This method uses the value of the data field as a parameter and returns it as a string. The bind method supports the read/write function, so the BIND function is used for Bidirectional (updatable) binding. This method retrieves the value of the data-bound control and submits any changes to the database.

 

3) innerhtml: You can define the ID and runat attributes for front-end labels such as <ul> <li> <div>, and then bind the innerhtml of the ID in the background code. This method is very convenient and can achieve interaction between the front and back ends, but pay attention to the escape characters in some HTML tags and attribute values in innerhtml. Being careful is very important. I forgot to write the end label for <A>, which leads to misplacement in IE 8. However, everything works normally in other browsers, and sometimes the problem cannot be solved. I thought it was a problem of front-end design compatibility. How can this problem be solved for a long time.

 

4) Write <% = dll_info.bll.getnewslist.getlist () %> in HTML code

Write the static method getlist with return values in the background, bind the relevant HTML code in the background, and return it to the foreground. In fact, it is similar to the above method, but this method can achieve code reuse well. However, it cannot effectively interact with some server controls on the page.

 

5) another common problem is writing JavaScript code for processing. I will not give an example here.

 

I think the world of coding can always have a dream, regardless of age or gender. The only restriction is interest.

 

 

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.