文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>求教Jquery的Ajax事件

求教Jquery的Ajax事件

时间:2010-10-15  来源:hbgdluck

脚本代码:

$("#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)
                            {
                               
                            }
                        })
                    }
               });

前台代码:

<tr>
                                            <td align="left" width="100">
                                                区域:
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="drpRegion" runat="server" AutoPostBack="false"
                                                    onselectedindexchanged="drpRegion_SelectedIndexChanged1">
                                                </asp:DropDownList>
                                                <asp:Label ID="lbregion" runat="server" Text=""></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left" width="100">
                                                镜头:
                                            </td>
                                            <td>
                                                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%" CssClass="gridview_m">
                                                    <Columns>
                                                        <asp:BoundField DataField="name" HeaderText="设备名称" />
                                                        <asp:BoundField DataField="regionname" HeaderText="区域名称" />
                                                    </Columns>
                                                </asp:GridView>
                                            </td>                                          
                                        </tr> 

后台代码:

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {                                     
                if (Request.QueryString["regionid"] != null)
                {
                    Bind(Request.QueryString["regionid"]);
                }            
            else
            {
                Page.RegisterStartupScript("", "<script>top.location.href='../Login.aspx'</script>");
            }                  
        }       
    }

 

///绑定GridView 的方法

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

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载