My personal summary on recently modifying Web parts

Source: Internet
Author: User
Recently, several Web parts have been improved Code It was only three months before the Web part was exposed to the layer, and all the Web parts were completed by other colleagues. I could only improve the Web parts from a small point of time, I have gone through only a few of them, but as a "cainiao" for Web Part development, it cannot be said that it has gone through a lot of twists and turns and troubles. Although it is much less efficient, however, the tasks are basically completed as required. In the future, there will be a lot of improvements or new projects. Now we will summarize some experiences and lessons, which is a review of our work and a record of our experiences.

  1. First, you must have a testing environment. Otherwise, you will not be able to complete complex tasks. For more information, see How to debug webpart.ArticleIn this regard, I have taken a lot of detours and wasted a lot of waiting time;
  2. The difference between list and view in SPS must be understood. List is similar to the table in dB, while view is just a custom subset of list, just like view in dB, A list can have multiple views;
  3. You must understand the differences between the display name and internal name of the field in the list, and pay attention to the differences between the two.ProgramIt is best to use internal name, especially in spquery, which can only use internal name, while using display name may cause errors or fail to get the desired record, I am wasting a lot of time and debugging;
  4. You must have a certain understanding of SP query, because most of the records in list/view need to use spquery, so the syntax must be understood. For details, see wss sdk, or an article about spquery in the previous blog;
  5. In the control of webpart, pay special attention to the name of its ID, which I also encountered a lot of problems, such as I used the display name as the ID, however, it is found that there are spaces in the display name, which may cause some functions of the control to be unable to be used normally. For example, datetimecontrol, the display calendar cannot be clicked, in the end, I wasted my "Precious" 60 available points, or I found this problem through debug and solved it myself, and when I named the ID, some users can use a guid to make it unique, but in my use, it is found that when using guid, it causes related events to not work, this issue needs further research;
  6. Some research on JavaScript is required. For example, I encountered the problem of record paging. At the beginning, I didn't want to solve it with JavaScript, and I wanted to use PostBack, using querystring to pass Parameters is solved by dataset in the background, which is finally solved by another colleague using JavaScript + Div, so that no PostBack is needed, which greatly improves the efficiency;
  7. To understand createchildcontrol and render, do not assign values to the displayed control in render. Otherwise, it will fail, the corresponding events should be processed in createchildcontrol. When querystring is used to transmit parameters, you must also consider when to set the values, at the same time, you need to know when the variables you have defined will be reinitialized. Instead of using the values stored in them, you need to revalue them.

For the time being, I think about this. It basically involves many difficulties and difficulties that I have encountered and may encounter more problems in the future. Let's make the problem more intense, I can also solve and learn more knowledge and skills.

I will try to write it here to facilitate searching and review.

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.