[Original] fineui Secret Garden (4)-page-level Configuration

Source: Internet
Author: User

Every page using the fineui control must contain a pagemanager control. We can regard the pagemanager control as a page-level parameter configuration (relative to the Web. config site-level parameter configuration ).

 

Page-level parameter configuration

 

  • Theme: Control topic. Currently, three theme styles (blue/gray/access, default value: Blue) are supported)
  • Language: Control Language (EN/zh_cn/zh_tw/..., default value: zh_cn)
  • Formmessagetarget: Display location of the error message in the form field (side/QTip, default value: side)
  • Formoffsetright: width of the border to the right of the form field (default: 20px)
  • Formlabelwidth: the label width of the form field (default value: 100px)
  • Formlabelseparator: form field label and content separator (default value :":")
  • Enableajax: whether to enable Ajax (default value: True)
  • Ajaxtimeout: Ajax timeout time (unit: seconds, default value: 60 s)
  • Enablebigfont: whether to enable the large font. Change the default 11px font of extjs to 12px. Otherwise, the Chinese font displayed is too small (default: false)

The above parameters are the same as those in Web. config, except that the scope is within the page range and overwrite the Same Name configuration in Web. config.

 

There are other configuration attributes:

  1. Enablepageloading: whether to enable the first loading prompt on the page. The default value is the loading icon displayed in the center (default value: true)
  2. Enableajaxloading: Indicates whether to enable the Ajax loading prompt. By default, the text prompt is located at the top of the page (default: true)
  3. Executeonreadywhenpostback: whether to execute the onready script every time the page is sent back (default value: True)

Although fineui requires developers to write as few JavaScript scripts as possible, sometimes the right script can get twice the result with half the effort. For example, the example site introduces an external default. JS to process the event and address bar # After the user clicks on the left menu:

   1:  
   2:  <body>
   3:      <form>
   4:      </form>
   5:      <script src="./js/default.js" type="text/javascript"></script>
   6:  </body>
   7:  

All the code in default. JS is placed in a functiononready (){}

.

 

This is actually a fineui Convention. fineui will find whether the onready function exists after extjs and its own scripts are executed. If so, execute this function. You can enable debugmode in Web. config, observe the generated page source code, and finally you will see the script:

 

 

Occupies the Panel-autosizepanelid attribute of the entire page

This is an attribute that you will never miss. If you want a panel, window, tree, tabstrip, regionpanel, or form to occupy the entire page space, you need to use this attribute, let's take a look at the sample site:

 

 

 

Make the ASP. Net Control also participate in fineui's Ajax sending-ajaxaspnetcontrols attribute

 

As we mentioned in the first article, one design concept of fineui is to "implement 80% functions with great care". That is to say, some tasks that cannot be completed by the controls provided by fineui will surely be encountered. What should we do? We have to turn to ASP. NET controls, and fineui provides an elegant way to allow ASP. NET controls to also participate in the Ajax re-sending process, which is the ajaxaspnetcontrols attribute.

 

If you want an ASP. NET to be updated during page sending, you can put its ID in the ajaxaspnetcontrols attribute. Multiple Control IDs are separated by commas. For more information, see the example Page.

 

So how does fineui achieve this?

The truth is actually very simple. fineui will look for the ASP in the generated HTML fragments in the Ajax response. net Control, get ASP. net generate HTML and update scripts. If you use debugging tools such as firebug to view Ajax requests, you can clearly see the following interaction process:

 

 

If you can understand how fineui works, try this example. This example mainly describes the differences between the label and literal controls of ASP. NET in the Ajax interaction process of fineui. Let's take a look at the Code:

   1:  <ext:PageManager ID="PageManager1" AjaxAspnetControls="Label1,Literal1" runat="server" />
   2:  <asp:Label ID="Label1" Text="Label1" runat="server"></asp:Label>
   3:  <br />
   4:  <asp:Literal ID="Literal1" Text="Literal1" runat="server"></asp:Literal>
   5:  <br />
6: <Ext: button id = "button1" runat = "server" text = "update the preceding text values" onclick = "button#click">
   7:  </ext:Button>
   1:  protected void Button1_Click(object sender, EventArgs e)
   2:  {
   3:      Label1.Text = "Label1 - " + DateTime.Now.ToLongTimeString();
   4:      Literal1.Text = "Literal1 - " + DateTime.Now.ToLongTimeString();
   5:  }

 

If you only read this code, we may assume that ASP: Label and ASP: literal are updated when you click the button, but the actual situation is not like this:

Why is it worth updating only label1, while literal1 is not updated? Look at the generated HTML source code and think about the internal processing process of fineui. It is not hard to find out the mysteries.

Generated HTML source code:

   1:  <span id="Label1">Label1</span>
   2:  <br />
   3:   Literal1
   4:  <br />
   5:  <div id="Button1_wrapper"></div>

The format of HTML code generated by ASP: Label and ASP: literal is different. The HTML code generated by ASP: literal does not have an external <span> tag, no wonder fineui cannot use the id value to search for literal and update its HTML value. What should I do?

In this special case, fineui does not intend to make literal and label Behavior consistent, but provides a simple solution (nesting a layer of SPAN or Div label outside literal ):

Is it fun ......

 

 

Summary

Each page requires a pagemanager control, which provides page-level parameter configuration and can be used to overwrite the configuration in Web. config. However, the autosizepanelid attribute is most often used to extend the panel to the entire page.

In the next article, we will introduce the most commonly used button controls. fineui provides a rich array of functions for buttons.

 

Note: The articles in the "fineui Secret Garden" series were originally published on sanshenshi, And the blog garden was first launched. Please indicate the source for reprinting. Document Catalog official forum

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.