博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在InfoPath中显示列表信息

Posted on 2008-01-10 17:56  joyoye  阅读(588)  评论(1编辑  收藏  举报
源于人的'惰性',需要直接在审批页面显示列表信息而不用再点链接进取看,关键点是把列表的信息(workflowProps.Item.Title等)绑定到taskProps.ExtendedProperties中(而不像从infopath中取数据还要序列化/反序列化那样麻烦)并在infopath设置相关控件通过连接进行绑定,
如果使用Form页面甚至直接把列表项信息完整的自动绑定到合适的web控件。


大致要点:
1、Code:workflow1.cs
  private void createTask1_MethodInvoking(object sender, EventArgs e)
        
{
            taskId 
= Guid.NewGuid();
            taskProps.Title 
= "Demo Task:" + workflowProps.Item.Title;
            taskProps.AssignedTo 
= assignee;
            taskProps.Description 
= instructions;
            taskProps.ExtendedProperties[
"comments"= comments;
            taskProps.ExtendedProperties[
"instructions"= instructions;

            itemTitle = workflowProps.Item.Title;
            taskProps.ExtendedProperties["itemTitle"] = itemTitle;
        }
2、Xml:ItemMetadata
<z:row xmlns:z="#RowsetSchema"
       ows_instructions
=""
       ows_itemTitle
=""
/>
3、InfoPath:Add the workflow task schema to your form as a secondary data source
4、InfoPath:Data-bind the itemTitle TextBox control to the instructions elements in the workflow task schema.