1 The difference between dynamic and static web pages 2 isPostBack function for example Please 3Q

Updated on technology 2024-04-11
11 answers
  1. Anonymous users2024-02-07

    Static web pages generally refer to HTML pages that do not contain interactive programs or only contain some simple interactive programs (such as: js), which are difficult to maintain, and need to directly change the page files to change the display effect of the page Dynamic pages refer to pages that can be interacted with and have a background program database, such as jsp asp php, etc., the advantage is that the function and management ispostback is a property of the page class, and the return value is a boolean value. This is usually done in the page load event.

    The value is false when the page is opened for the first time, and true if the current page is a submitted pageIn layman's terms, when your leaf first logs in, it will call if(!).ispostback), and when you re-enter the page before the page is closed (e.g., with back<-return to the page), the statement in the page will no longer be called; The system says whether to send the page back to the web server!

    The function does this by getting a value that indicates whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time. Remember that some states must be placed in this, otherwise there will be some inexplicable errors, and every time you click the server-side button, the page load event will be called for page class refactoring, and then the response event will be called, such as page commit, etc., if (!).ispostback) ispostback refers to whether or not to call this page for the first time.

    If you want to do some settings on a page that you only need to do once, you can put them in this one. There are features to speed things up. In the page load The ** to be executed every time the page is refreshed is written above if ispostback() then exit sub is executed only once, written below it Example [Visual Basic, C , jScript] The following example tests the value of the ispostback property to call the method conditionally for all validation server controls when the page is loaded.

    visual basic] sub page_load if not ispostback ' validate initially to force the asterisks ' to appear before the first roundtrip. validate() end if end sub [c#] void page_load() jscript] function page_load()

  2. Anonymous users2024-02-06

    The difference between dynamic web pages and static web pages is mainly that they are easy to manage, dynamic web pages can use background operations, while static web pages should be updated locally and then re-uploaded. There is also the difference in the effect of the page, for example, a dynamic web page can have a drop-down dynamic menu, but a static page cannot. ispostback role:

    The procedures to be executed when you first visit the page, similar to the initialization page, will not be executed after you click some buttons on the current page.

  3. Anonymous users2024-02-05

    It can also be used when modifying.,When you want to modify.,When the page loads,You can assign a value to this control in the back**.。 Then you can modify if (!ispostback) We also use this control, and it works great.

  4. Anonymous users2024-02-04

    ispostback is a property of the bool type in the page classto determine whether a request for the current form is the first or non-first request. When ispostback is true, it means that it is not the first request, which we call postback, and when ispostback is false, it means that the first source reports the second request.

    When we use webform for our own development, we often judge ispostback in the page load, because the page load will be executed when the first request is made, and the page load will be executed when it is not the first request. Why are there multiple requests for the same form? Server-side events are introduced in the server, which supports the control of the server with split-side events, which will make a request to the current form, so in many cases we need to distinguish whether it is the first request to this form.

    So in the program program there are generally.

    page load event.

    if(!ispostback)

    Loaded on the first request, note the "! ”

  5. Anonymous users2024-02-03

    If this page is an update operation, you need it (if the commit event is handled in the CS file), if there is no ispostback, the updated value will not be saved in any case, for example:

    protected void page_load(object sender, eventargs e)

    Update the event.

    protected void btnsub_click(object sender, eventargs e)

  6. Anonymous users2024-02-02

    Literally, it is whether or not to post.

    The difference with JSP is that it encapsulates web requests, even control requests, and it takes the postback requests for each control, but writes them as scripts. Once the server side needs to request the request on the page, the request will be returned, that is, postback, then the ispostback attribute will appear.

  7. Anonymous users2024-02-01

    The principle is simple, suppose your static template page has a MyTitle flag in addition to the basic HTML markup, as follows:

    In this case, in the process of generating a static page for your dynamic page, the text will be read first (which is actually the template page), then the specified markup will be replaced (in this case, $mytitle$), and then the text will be saved as an html file, and that's it, of course, just the simplest.

    In fact, it is more recommended to use template engine technology, customize a set of your own rules, and then achieve it through reflection, so that the effect is better, of course, here is the template technology, and the static page technology is still a little different, but the two are very good to use together.

  8. Anonymous users2024-01-31

    If it is dynamic to static: if it is true static, it is generally to generate a static page when adding data; If it's pseudo-static, you'll have to rewrite the url

  9. Anonymous users2024-01-30

    Use the method of page rewriting.

    response is a property inherited from the page class of the current page class, the actual value is an object of the httpresponse class, and redirect is a member method of it, using example:

  10. Anonymous users2024-01-29

    using system; using ; using ; using ; using ; using ; using bll; using model; using ; using ; public partial class test_repeaterfenye : private void binddata() else = curpage - 1; = pds; ;= ""; += "Shared

    records.; = "Displayed on each pageStrip.; = "altogetherPage.

    = "The current sectionPage. if (curpage == 1) else if (curpage == string htmlselectstring = ""; for (int i = 1; i <= ; i++)else }htmlselectstring += "

    = "" + htmlselectstring + "

    else }Note: The comment part is the effect of url rewrite... The value returned by li is all the records in the table obtained by the SQL query. For more information, please refer to the source.

  11. Anonymous users2024-01-28

    Haha, that's fine, research it yourself, ha.

Related questions
10 answers2024-04-11

Now most of the ** can be judged by the suffix of the file name, i.e. except. html and. The web pages at the end of htm are all dynamic web pages, but big web pages like baidu must be used, but the display is a static format, which is also a more popular way now, that is, in the dynamic ** on the server side to generate a series of static ** for customers to browse, and then use dynamic language to modify and update the static web page, this ** has a higher security factor.

6 answers2024-04-11

This kind of question, you can think in two directions:

First, your own problems. >>>More

3 answers2024-04-11

First, the reference is different.

1. Dynamic disk: refers to the local hard disk upgraded in the disk manager of the Windows operating system. >>>More

11 answers2024-04-11

The method for dynamically defining a 2-dimensional array in C++ is: >>>More

11 answers2024-04-11

I've had this issue before. Reinstalling IE won't solve the problem at all. >>>More