ASP. NET page no flush request implementation

Source: Internet
Author: User

ASP. NET page no flush request implementation





<%@ Page Language="C #"AutoEventWireup="true"codebehind="OmAjaxSubmit.aspx.cs"Inherits="OMDemo.demo.omAjaxSubmit" %><!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Headrunat= "Server"> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title></title> <Scriptsrc=".. /operamasks-ui/jquery-1.7.1.js "></Script> <Scriptsrc=".. /operamasks-ui/operamasks-ui.min.js "></Script> <Linkhref=".. /operamasks-ui/themes/apusic/operamasks-ui.css "rel= "stylesheet" /> <Script> varBtnclick; $ (document). Ready (function () { vartype; Btnclick= functionBtnclick (btn) {vartxt=$ (BTN). Val (); Type=txt; } $('#form1'). Bind ('Submit', function(e) {e.preventdefault ();//prevent form from default commit behavior varbtn=$ (e); $( This). Omajaxsubmit (//Submitting using AJAX{data: {Type:type},//target: "#output"target:document.body}); }); }); </Script></Head><Body> <formID= "Form1"runat= "Server"> <Div> <inputtype= "text"runat= "Server"name= "Name"ID= "Name"value=" " /> <inputtype= "text"runat= "Server"name= "Age"value=" "ID= "Age" /> <Asp:buttonID= "Button1"runat= "Server"Text= "Add"OnClientClick= "Btnclick (this)" /> <Asp:buttonID= "Button2"runat= "Server"Text= "Edit"OnClientClick= "Btnclick (this)" /> <Asp:buttonID= "Button3"runat= "Server"Text= "Del"OnClientClick= "Btnclick (this)" /> <DivID= "Output"></Div> </Div> </form></Body></HTML>

The background is as follows:

UsingSystem;UsingSystem.Collections.Generic;UsingSystem.Linq;Usingsystem.web;UsingSystem.Web.UI;UsingSystem.Web.UI.WebControls;Namespaceomdemo.demo{PublicPartialClassOmAjaxSubmit:System.Web.UI.Page {Protectedvoid Page_Load (Objectsender, EventArgs e) {var type = request["Type"];if (type = ="Add") {var name = request["Name"];var age = request["Age"]; Response.Write ("Add to:"+ name +Age); Response.End (); }Elseif (type = ="Edit") {//response.write ("Modify:" + name.) Value + age. Value); Name. Value =  China Song Xingju " ; //response.end ();  " Span style= "color: #0000ff;" >else if (type = = del< Span style= "color: #800000;" > "" {Response.Write ( Delete:  age. Value); //response.end ();   

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.