二级下拉框

来源:互联网 发布:沈阳网络系统安全技术 编辑:程序博客网 时间:2024/06/02 21:27

$(function () {
    $("#ddl_GpyBrand").change(function () {
        BindGpy();
    });
});


function BindGpy() {
    var gpybrand = "";
    gpybrand = $("#ddl_GpyBrand").val();
    $("#ddl_GpyVersion").empty();
    $("#ddl_GpyVersion").prepend("<option value=''>--请选择--</option>");


    var par = "action=getGPY&gpybrand=" + gpybrand;
    $.ajax({
        type: "POST",
        url: handleurl,
        data: par,
        dataType: "json",
        error: function (xmlHttpRequest, textStatus, errorThrown) {
            $.tipMessage('错误', errorThrown, 'error');
        },
        success: function (returnJsonValue) {
            $.each(returnJsonValue, function (k, item) {
                $("#ddl_GpyVersion").append("<option value=" + item.SCODE + ">" + item.SVALUE + "</option>");
            });
        }
    });

}


private  void getGPY()
        {
            string str = " where 1=1  and iuse=1  ";
            string gpybrand = GetParam("gpybrand");
            if (!string.IsNullOrEmpty(gpybrand))
            {
                str += "  and spcode='" + gpybrand + "' ";
            }
            str += " order  by  scode  ";
            DataTable dt = OracleHelper.ExecuteOracleToTable("select SCODE,SVALUE  from BASEINFO_DICT" + str);
            if (dt != null)
            {
                Output(JsonHelper.DataTableToJson(dt));
            }
        }