asp.net 一般處理常式

來源:互聯網
上載者:User

標籤:lock   web   data   alt   trim   聯絡   splay   function   try   

一般處理常式類似公用模組,所有頁面都可以調用。

一般處理常式

<%@ WebHandler Language="C#" Class="SetGrid" %>using System;using System.Web;public class SetGrid : IHttpHandler {        public void ProcessRequest (HttpContext context) {        string sql = "";        System.Data.DataTable dtTmp = null;        string sf = "";        string result = "";        try        {            switch (context.Request["oper"])            {                case "Supplier"://供應商                    sql = "select ID,abbreviation,name,linkman1,Tel,trmo,currency,cess from provider";                    if (!string.IsNullOrEmpty(context.Request["q"]))                    {                        sf = context.Request["q"].ToString().Trim();                        sql += " where abbreviation like ‘%" + sf + "%‘ or linkman1 like ‘%" + sf + "%‘ or name like ‘%" + sf + "%‘ or Tel like ‘%" + sf + "%‘";                    }                    dtTmp = pubCommon.GetDataTable(sql);                    result = pubCommon.DataTableToJson(dtTmp);                    //result = "[{\"si_name\":\"三菱\",\"si_linkman\":\"村上\",\"si_mobile\":\"12-002136\"},{\"si_name\":\"西門西\",\"si_linkman\":\"Jon\",\"si_mobile\":\"0223-26565\"}]";                    break;                case "PODetail":                    sql = "select 1 as gi_id,*,12 as pi_number,12 as qty from materiel where code = ‘110010030092‘";                    dtTmp = pubCommon.GetDataTable(sql);                    if (dtTmp != null)                    {                        result = pubCommon.DataTableToJson(dtTmp);                    }                    break;                case "Query":                    sql = "select * from materiel";                    dtTmp = pubCommon.GetDataTable(sql);                    if (dtTmp != null)                    {                        result = pubCommon.DataTableToJson(dtTmp);                    }                    break;            }        }        catch (Exception ex)        {        }        context.Response.Write(result);        context.Response.End();    }     public bool IsReusable {        get {            return false;        }    }}
View Code

 

指令碼

    //供應商    $(‘#gys_key‘).combogrid({        panelWidth: 350,        delay: 500,        mode: ‘remote‘,        idField: ‘ID‘,        textField: ‘abbreviation‘,        url: ‘/Project2/Dispose/SetGrid.ashx?oper=Supplier‘,        columns: [[                        { field: ‘abbreviation‘, title: ‘簡稱‘, width: 80 },                        { field: ‘name‘, title: ‘供應商名稱‘, width: 120 },                        { field: ‘linkman1‘, title: ‘連絡人‘, width: 80 },                        { field: ‘Tel‘, title: ‘電話‘, width: 100 }                    ]],        onSelect: function (rowIndex, rowData) {            $("#txtTax").val(rowData.cess);            $("#txtpay").val(rowData.trmo);            $("#txtcurrency").val(rowData.currency);        }    });

 

asp.net 一般處理常式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.