前台代码:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyWorkflowSearch.ascx.cs"
    Inherits="OThinker.H3.Portal.Controls.MyWorkflowSearch" %>
<%@ Register Assembly="OThinker.H3.WorkSheet" Namespace="OThinker.H3.WorkSheet" TagPrefix="SheetControls" %>
<link href="<%=this.PortalCssRoot %>/MainUI.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    body
    {
        padding: 0;
        margin: 0;
        font-size: 12px;
    }
    .text
    {
        width: 99%;
    }
    .text li
    {
        float: left;
        padding-right: 20px;
        margin-top: 10px;
        list-style: none;
        width: 80px;
        text-align: center;
        margin-bottom: 5px;
    }
    .topnav
    {
        width: 100%;
        height: 25px;
        background-color: #eaf4fc;
        line-height: 25px;
        padding-left: 13px;
        font-weight: bold;
        clear: both;
    }
</style>
<div class="tableWrap" style="min-height: 360px;">
    <table class="flow_info_menu" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                模板类型:&nbsp;
                <asp:TextBox ID="txtWorkflowPack" runat="server" Width="91px"></asp:TextBox>&nbsp;&nbsp;
                模板名称:&nbsp;
                <asp:TextBox ID="txtWorkflowName" runat="server" Width="91px"></asp:TextBox>&nbsp;&nbsp;
                <asp:LinkButton ID="btnSearch" runat="server" OnClick="btnSearch_Click">查询</asp:LinkButton>
            </td>
        </tr>
    </table>
    <div class="text">
        <asp:Repeater ID="repeaterWorkflow" runat="server" OnItemDataBound="repeaterWorkflow_ItemDataBound">
            <ItemTemplate>
                <div class="topnav">
                    <asp:Label ID="lblTitle" runat="server"><%#Eval("WorkflowPackage")%></asp:Label></div>
                <div class="text">
                    <asp:Repeater ID="subRepeaterWorkflow" OnItemDataBound="subRepeaterWorkflow_ItemDataBound"
                        runat="server">
                        <ItemTemplate>
                            <li><span>
                                <asp:HyperLink ID="linkWorkflow" runat="server">
                                    <SheetControls:BinaryImage ID="binImgIcon" runat="server" />
                                    <asp:Image ID="imgIcon" runat="server" />
                                </asp:HyperLink>
                            </span>
                                <br />
                                <span>
                                    <asp:HyperLink ID="linkWorkflow1" runat="server"></asp:HyperLink>
                                </span></li>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
</div>
<script type="text/javascript" language="javascript">
    function openWindow(openurl) {
        //var x = (screen.height - height) / 2;
        //var y = (screen.width - width) / 2;
        var theopenwindow;
        theopenwindow = window.open(openurl);
        theopenwindow.focus();
    }
</script>

后台代码:

using System;
using System.Data;
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 OThinker.H3.WorkSheet;

namespace OThinker.H3.Portal.Controls
{
    /// <summary>
    /// 显示所有我可以发起的流程模板
    /// </summary>
    public partial class MyWorkflowSearch : PortalControl
    {
        /// <summary>
        /// 打开该页面需要拥有的权限
        /// </summary>
        public override string FunctionCode
        {
            get
            {
                return OThinker.H3.Acl.FunctionDef.Workspace_MyWorkflow_Code;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnSearch_Click(sender, e);
            }
        }
        //查询按钮事件
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //得到当前用户所拥有发起权限的流程模板
            DataTable table = OThinker.H3.Query.QueryWorkflow(this.UserValidator.RecursiveMemberOfs2);
            //得到一个流程模板结果集的视图
            DataView dv = table.DefaultView;
            //通过搜索条件过滤得到需要显示的流程模板类型
            dv.RowFilter = "1=1";
            if (!string.IsNullOrEmpty(this.txtWorkflowPack.Text))
            {
                dv.RowFilter += " AND WorkflowPackage like '%" + this.txtWorkflowPack.Text + "%'";
            }
            if (!string.IsNullOrEmpty(this.txtWorkflowName.Text.Trim().Trim()))
            {
                dv.RowFilter += " AND WorkflowName like '%" + this.txtWorkflowName.Text.Trim().Trim() + "%'";
            }
            //绑定模样类型需要显示的控件
            this.repeaterWorkflow.DataSource = dv.ToTable(true, "WorkflowPackage");
            this.repeaterWorkflow.DataBind();
        }
        //绑定repeater行事件
        protected void repeaterWorkflow_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            //取得前台控件
            DataRowView rowv = (DataRowView)e.Item.DataItem;
            Label lblTitle = e.Item.FindControl("lblTitle") as Label;
            lblTitle.Text = rowv["WorkflowPackage"] + string.Empty;
            Repeater subRepeaterWorkflow = e.Item.FindControl("subRepeaterWorkflow") as Repeater;
            //得到当前用户所拥有发起权限的流程模板
            DataTable table = OThinker.H3.Query.QueryWorkflow(this.UserValidator.RecursiveMemberOfs2);
            //视图加入条件筛选
            DataView dv = new DataView(table);
            dv.RowFilter = "WorkflowPackage = '" + rowv["WorkflowPackage"] + string.Empty + "'";
            if (!string.IsNullOrEmpty(this.txtWorkflowName.Text.Trim().Trim()))
            {
                dv.RowFilter += " AND WorkflowName like '%" + this.txtWorkflowName.Text.Trim().Trim().Trim() + "%'";
            }
            //绑定流程模板显示控件
            subRepeaterWorkflow.DataSource = dv.ToTable(true, new string[] { "WorkflowPackage", "WorkflowName", "DefaultVersion", "IconContent" });//得到的数据源过滤重复行
            subRepeaterWorkflow.DataBind();
        }
        //绑定repeater行事件
        protected void subRepeaterWorkflow_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataRowView rowv = (DataRowView)e.Item.DataItem;                            //当前行的字段数据
            HyperLink linkWorkflow = e.Item.FindControl("linkWorkflow") as HyperLink;
            HyperLink linkWorkflow1 = e.Item.FindControl("linkWorkflow1") as HyperLink;
            Image imgIcon = e.Item.FindControl("imgIcon") as Image;
            BinaryImage binImgIcon = e.Item.FindControl("binImgIcon") as BinaryImage;   //H3图片控件

            string imageUrl = PortalPage.GetPortalImageRoot(this.Page) + "/Workflow.png";//默认图标路径
            string urlStr = string.Empty;
            string workflowPackage = rowv["workflowPackage"] + string.Empty;//流程模板类型名称
            string workflowName = rowv["WorkflowName"] + string.Empty;      //流程模板名称
            string workflowVersion = rowv["DefaultVersion"] + string.Empty; //版本号
            byte[] IconContent = rowv["IconContent"] as byte[];             //图标文件字节
            //如果存在图标
            if (IconContent != null)
            {
                binImgIcon.Binary = IconContent;//生成图片得到图片路径
                binImgIcon.Visible = true;
                imgIcon.Visible = false;
            }
            else
            {
                imgIcon.ImageUrl = imageUrl;
                binImgIcon.Visible = false;
                imgIcon.Visible = true;
            }
            urlStr += "javascript:openWindow(encodeURI(\'StartInstance.aspx?WorkflowPackage=" + workflowPackage + "&WorkflowName=" + workflowName + "&WorkflowVersion=" + workflowVersion + "&&PageAction=Close\'));";
            //图标上的链接
            linkWorkflow.NavigateUrl = urlStr;
            //图标下文字链接
            linkWorkflow1.NavigateUrl = urlStr;
            linkWorkflow1.Text = workflowName;
        }
    }
}