C#jbox小节

1.在web开发中jbox当做层来使用,效果图如下:红框里面的为jbox实现的小窗体

2.使用方法:首先创建一个html页或者web窗体,设计好小窗体控件啥的,如上图的web窗体也设计如下:

3.使用2中创建好的页面来作为窗体弹出,在这里我介绍两种方式

(1).在需要弹出子窗体的页面上使用html控件</asp:Label><input id="Button6" type="button" value="添加综合二级频道"  onclick="addZongHePinDao(1);"/>,并且定义按钮的 onclick事件,

再此说明用html控件的好处是,不会返回刷新过程。然后再以添加了input控件的同一个页面的heah里面写addZongHePinDao事件的js代码区调用jbox窗体,也就是用jbox调用2的窗体。

<script src="../Scripts/jquery-1.7.1.js"></script>

<script src="../Scripts/jBox/jquery.jBox.js"></script>
<link href="../Scripts/jBox/Skins2/Blue/jbox.css" rel="stylesheet" />
<script type="text/javascript">
function addZongHePinDao(PDname) {//jbox窗体 PDname是给窗体页面传去的参数,以便知道是那个按钮传过去的
var url = "iframe:/Main/addErJiPinDao.aspx?lb=" + PDname;
$.jBox(url, {
title: "添加频道",
width: 500,
height: 200,
buttons: { '关闭': true }
});
}

</script>

最后在2页面的后台上接收参数,并完成子窗体的操作

 

(2)在页面上创建sap的button控件,使用后台调用前台页面js函数的方式,也可以实现相同的过程,但是在此过程中会有刷新的过程。

 web窗体如下:

父窗体前台的js函数如下:

function gengxin(Bianhao) {
//alert(Bianhao);
var url = "iframe:/Main/updatePinDao.aspx?ID="+Bianhao;
$.jBox(url, {
title: "修改频道",
width: 500,
height: 200,
buttons: { '关闭': true }


});
}

 

 

在父窗体后台写,后台调用页面的js函数,也就是js函数里面写好的jbox窗体过程

string hs = "gengxin(" + index.ToString() + ");";
// Response.Write(newsName);
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Alert", hs, true);//调用js页面函数,调出jbox窗体

 

 

 

然后再Button2的OnClick后台事件中写子窗体的操作

posted on 2014-01-10 16:45  Q11三工鸟yue  阅读(419)  评论(0编辑  收藏  举报