当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > Coolite Cool Study 2 同时更新多个Tab

ASP.NET
为T-SQL添加intellisense功能
SQL Server 2005安装过程中出现错误的解决办法
SQL Server 2005 RTM 安装错误 :The SQL Server System Configuration Checker cannot be executed due to
有关于JSON的一些资料
不能忽略c#中的using和as操作符的用处
JavaScript系列之―同步还是异步?
获取远程网页的内容之一(downmoon原创)
获取远程网页的内容之二(downmoon原创)
ASP.Net中防止刷新自动触发事件的解决方案
asp.net下用js实现鼠标移至小图,自动显示相应大图
Asp.Net 和 AJAX.Net 的区别
提交页面的定位--scrollIntoView的用法
利用AJAX与数据岛实现无刷新绑定
asp.net下判断用户什么时候离开,以什么方式离开
DataSet 添加数据集、行、列、主键和外键等操作示例
读写xml所有节点个人小结 和 读取xml节点的数据总结
收藏的asp.net文件上传类源码
asp.net下GDI+的一些常用应用(水印,文字,圆角处理)技巧
一个可以让.net程序在非WIN平台上运行的软件Mono
使用ASP.NET 2.0 CSS 控件适配器生成CSS友好的HTML输出

ASP.NET 中的 Coolite Cool Study 2 同时更新多个Tab


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-11   浏览: 168 ::
收藏到网摘: n/a

前段时间有一个需求是这样子的——录入一个查询条件, 出来的查询结果是多张页面。不知道有没朋友遇到这个问题。 展现的效果大概是这个样子 UpdateMultiTabs
UpdateMultiTabs_2

当时用Coolite做测试遇到两个问题:

1. 传递给Tab的Url参数会莫名其妙的被添加上其他字符(到Coolite论坛上问了一下估计是bug)。正常情况下,google搜索url是这个样子:http://www.google.com/search?q=Hello 但因为Coolite在Tab的Url后面添加了某些字符,结果变成这样:http://www.google.com/search?q=Hellosfkjsdkfjskdf, 解决办法是把搜索Url设成这样形式:http://www.google.com/search?q=Hello&End=Y ,呵呵!!

2. 多个Tab同时加载页面引起冲突,导致后面加载的Tab页面有javascript错误。解决办法很简单,TabPanel的属性 DeferredRender="false" 就OK了。

完整代码:

<%@ Page Language="C#" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"> protected void Page_Load(object sender, EventArgs e) { } protected void UpdatePage(object sender, AjaxEventArgs e) { string keyWord = txtS.Text; string url; url = "http://www.google.com/search?q=" + keyWord + "&End=Y"; tabDtlInfo.Load(new LoadConfig { Mode = LoadMode.IFrame, Url = url, NoCache = true, ShowMask = true }); url = "http://cnweb.search.live.com/results.aspx?q=" + keyWord + "&End=Y"; tabChgInfo.Load(new LoadConfig { Mode = LoadMode.IFrame, Url = url, NoCache = true, ShowMask = true }); url = "http://www.flickr.com/search/?q=" + keyWord + "&End=Y"; tabSmyInfo.Load(new LoadConfig { Mode = LoadMode.IFrame, Url = url, NoCache = true, ShowMask = true }); }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"> <title>Update 3 Pages</title>
</head>
<body style="padding:15px,5px,5px,15px;"> <form id="form1" runat="server"> <ext:ScriptManager ID="ScriptManager1" runat="server" AjaxViewStateMode="Include"> </ext:ScriptManager> <table > <tr> <td style="padding:15px,5px,5px,15px;"> Search: </td> <td style="padding:15px,5px,5px,15px;"> <ext:TextField runat="server" ID="txtS" Width="300"> </ext:TextField> </td> <td style="padding:15px,5px,5px,15px;"> <ext:Button ID="btnTest" runat="server" Text="Search By Multi-Engine" Icon="Accept"> <AjaxEvents> <Click OnEvent="UpdatePage"> <EventMask ShowMask="true" MinDelay="500" Msg="Updating Page..." /> </Click> </AjaxEvents> </ext:Button> </td> </tr> </table> <ext:TabPanel runat="server" ActiveTabIndex="0" Border="true" Height="500" DeferredRender="false" > <Tabs> <ext:Tab ID="tabDtlInfo" runat="server" Title="Google" Height="500" Frame="true" > </ext:Tab> <ext:Tab ID="tabChgInfo" runat="server" Title="Live" Height="500" Frame="true"> </ext:Tab> <ext:Tab ID="tabSmyInfo" runat="server" Title="Filckr" Height="500"> </ext:Tab> <ext:Tab ID="tab1" runat="server" Title="AutoLoad_Google" Height="500" Frame="true"> <AutoLoad NoCache="true" Mode="IFrame" ShowMask="true" Url="http://www.google.com/search?q=Hello&End=Y"> </AutoLoad> </ext:Tab> <ext:Tab ID="tab2" runat="server" Title="AutoLoad_Live" Height="500" Frame="true"> <AutoLoad NoCache="true" Mode="IFrame" Url="http://cnweb.search.live.com/results.aspx?q=Hello&End=Y"> </AutoLoad> </ext:Tab> </Tabs> </ext:TabPanel> </form>
</body>
</html>

PS: 这篇文章是用Windows Live Writer来写的,感觉效率高了很多,排版也好了,Cool, I like it!( – 。- !) 感觉有点卖广告味道~