• 求教Jquery的Ajax事件


    我选择下拉框列的时候无刷新的绑定GridView。值传过去了,也跳进了相应的方法,值也绑定上去了,可是页面上GridView还是没有值。是没有刷新的原因吗?有人能帮我解决下吗?

    脚本代码:

    $("#drpRegion").change(function(){                           
                        var id=$("#drpRegion").val();                   
                        if(id!=0)
                        {
                            $("#lbregion").html("");
                            $.ajax({
                                type:"POST",
                                url:"addrecordplan.aspx?regionid="+id,
                                datatype:"html",
                                success:function(data)
                                {
                                   
                                }
                            })
                        }
                   });

    前台代码:


                                               
                                                    区域:
                                               
                                               
                                                                                                        onselectedindexchanged="drpRegion_SelectedIndexChanged1">
                                                   

                                                   
                                               
                                           
                                           
                                               
                                                    镜头:
                                               
                                               
                                                   
                                                       
                                                           
                                                           
                                                       

                                                   

                                                                                          
                                             

    后台代码:

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {                                     
                    if (Request.QueryString["regionid"] != null)
                    {
                        Bind(Request.QueryString["regionid"]);
                    }            
                else
                {
                    Page.RegisterStartupScript("", "");
                }                  
            }       
        }

    ///绑定GridView 的方法

     void Bind(string regionid)
        {     
            DeviceSystem devicesys = new DeviceSystem();
            string message;
            List devicelist = devicesys.GetDeviceList(u.sessionid, u.nasid.ToString(), out message);
            List devices = new List();
            foreach (Device item in devicelist)
            {
                if (item.regionid.ToString() == regionid)
                {
                    devices.Add(item);
                }
            }
            GridView1.DataSource = devices;
            GridView1.DataBind();       
        }

  • 相关阅读:
    【笔记】:当SQL需要查询的字段过多,且存在个别字段不需要作展示,即去除指定查询字段,节省响应时间
    创新与重塑,佛塑科技打造集团型 CRM 建设标杆
    Blender DreamUV插件使用简明教程
    A*算法-Python实现
    MyBatis使用<foreach>标签like查询报错解决
    计算机组成与设计硬件软件接口学习1
    LeetCode(25)验证回文串【双指针】【简单】
    matlab小车运动轨迹增量式PID控制
    Latex常用宏包\usepackage
    COF-300, cas:1133843-97-6 ,共价有机框架
  • 原文地址:https://blog.csdn.net/m0_72431373/article/details/127772025