OrganicsDelivery总结
生活随笔
收集整理的這篇文章主要介紹了
OrganicsDelivery总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、UserControl調用所在頁面的其他內容(代理實現)
UserControl代碼
?
Codeusing?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.HtmlControls;
using?System.Collections;
public?partial?class?UserControl_Welcome?:?System.Web.UI.UserControl
{
????public?delegate?void?ButtonClickEventHandler(object?sender,?EventArgs?e);
????public?event?ButtonClickEventHandler?ButtonClick;
????protected?void?Page_Load(object?sender,?EventArgs?e)
????{
???????
????}
????protected?void?btnOrder_Click(object?sender,?EventArgs?e)
????{
????????ButtonClick(sender,e);
????}
}
?
頁面代碼
Codeusing?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.HtmlControls;
using?System.Text;
public?partial?class?_Default?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender,?EventArgs?e)
????{
????????Welcome1.ButtonClick?+=?new?UserControl_Welcome.ButtonClickEventHandler(Welcome_ButtonClick);
????}
????public?void?Welcome_ButtonClick(object?sender,?EventArgs?e)
????{
????????TabContainer1.ActiveTabIndex?=?1;
//由于用的AJAX控件,所以完成后AJAX控件要手動更新
????????UpdatePanel5.Update();
????}
?
二、javascript實現部分打印
??? 1、在頁面的代碼頭活末尾部處加入JavaScript:
Code
<script?language=javascript>???
function?doPrint()?{???
bdhtml=window.document.body.innerHTML;???
sprnstr="<!--startprint-->";???
eprnstr="<!--endprint-->";???
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);???
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));???
window.document.body.innerHTML=prnhtml;???
window.print();???
}???
</script>? ??? 2、在頁面正文處加上<!--startprint-->與<!--endprint-->標識。
??? 3、添加打印按鈕,執行JavaScript
轉載于:https://www.cnblogs.com/liuweicfyj/archive/2009/09/03/1559386.html
總結
以上是生活随笔為你收集整理的OrganicsDelivery总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载MSDN]IIS 7.0中的Liv
- 下一篇: 程序员的人生