Rendermode of updatapanel Learning

Source: Internet
Author: User
In the past, when using updatepanel, I always dragged an updatepanel in where I was about to refresh it and included the content to be refreshed. I am ashamed that I have never studied this control well. Recently, when I saw the Ajax application video on ASP.net on teacher Zhao's webcast, I realized that I had never developed the habit of seeking root questions. After watching the video, I felt a great deal. I decided to take a good note and sum up what I talked about in it and what I found on the Internet. It may be naive, but this is what I did not know before, put it here and remind yourself that you can only use and know what you want to learn.
Let's talk about the attributes of updatepanel. It contains a few attributes. During the Video watching process, I also typed some attributes according to the instance. Code And I realized the deep thoughts brought by these examples.
1. rendermode; it indicates the content contained in updatepanel. Specifically, No matter what server controls you use, the final client code is always one by one HTML Tag. For example, <asp: botton…>, The final page code will become <input...>. For updatepanel, it will also be converted into an HTML Tag. In the end, it depends on the attribute settings of rendermode. It has two values to choose from. One is block and the other is inline. I have understood from the literal meaning that it is not appropriate to say that one is block and the other is line. So let's take a look at his code. Let's take a look at the code in teacher Zhao's video to illustrate a problem. As follows.
Drag two updatepanels on the page as follows:
<Asp: updatepanel id = "updatepanel1" rendermode = "Block" runat = "server">
<Contenttemplate>
Block
</Contenttemplate>
</ASP: updatepanel>
Hello World
<HR/>
Dfdf
<Asp: updatepanel id = "updatepanel2" rendermode = "inline" runat = "server">
<Contenttemplate>
Inline
</Contenttemplate>
</ASP: updatepanel>
Hello World
I set two updatepanel's rendermode with different attribute values. What is the final result:

The first updatepanel is shown on the horizontal line, and the second updatepanel is shown on the horizontal line. Check the original code and find the following lines:
Dfdfdf
<Div id = "updatepanel1">

Block

</Div>
Hello World
<HR/>
Dfdf
<Span id = "updatepanel2">
Inline
</Span>
Hello World
As you can see, the updatepanel with the rendermode attribute set to block generates a div with the same ID as updatepanel, And the updatepanel with the rendermode attribute set to inline generates
Span with the same ID as updatepanel. This is the difference between the two. To further illustrate the problem. I now write down the difference between Div and span, which is not unknown to everyone. I just want to realize this.
Division is a block-level element that can contain paragraphs, titles, tables, and even chapters, summaries, and remarks. While span is a row element.
The front and back of a span do not have line breaks. It has no structure meaning and is purely an application style. When any element in other rows is inappropriate, you can use span.
<Span> A span tag has an important and practical feature, that is, it does nothing. its only purpose is to focus on other elements in your HTML code, in this way, you can specify styles for them.
<Span> the identifier allows you to divide a paragraph into different parts.
<Div> div is also used to create a logical part in an HTML file. Unlike <div> span, <div> is used at the text block level. It separates rows before and after the HTML elements it contains.
The biggest feature of Div and span elements is that they do not perform any formatting and rendering on objects in the element by default. It is mainly used to apply a style sheet. The most obvious difference between the two is that DIV is a block element, while span is a line element (also translated as an embedded element ).
Procedure :
1. The so-called block element is the element that starts rendering with another line. The element in the line does not need to start with another line. You will have a better understanding of the Code below the test example:
Test <span> test </span>
<Div> A new line is displayed here </div>
2. Block elements and intra-row elements are not static. They can be converted to each other by defining the display attribute values of CSS, for example:
Test <Div style = "display: inline"> keep up with the previous "test" display </div>
<Span style = "display: Block"> A new line is displayed here </span>
Tip: If no CSS attribute is defined for the DIV element, the display effect will be displayed on the P element.
Note
Because of the particularity of Div and span elements, it is generally used to apply style sheets. For example, CSS is used as a layer. What needs to be distinguished is the difference between block elements and intra-row elements, there is also a mutual conversion between the two. Div specifies the HTML Rendering container. SPAN specifies the embedded text container.
Statement: The above color change section was obtained from the Internet. The original address could not be found and was also reprinted from Article It's stuck. Its address is "difference between Span and Div (convert)"

According to the above description, I believe many people have already understood the difference between the block and the row mentioned above. Div is the block and span is the row.
This attribute has nothing to say here. The following attributes will be summarized later.

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.