本文介绍了如何在重复表内为InfoPath代码创建/设置超链接的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下面的方法,该方法为我提供了URL,并且我想设置点击此处".作为链接的文本

I have a below method, which gives me URL and I want to set "Click here" as text to the link

Fiedl17是信息路径中的超链接字段.所以它以field18作为文本

Fiedl17 is the hyperlink field in infopath. so it has field18 as text

不能像下面这样写xml

not able to write the xml like below

< my:field17 my:field18 =技能地图链接"> http://www.sharepoint.com</my:field17>

<my:field17 my:field18="Skill Map Link">http://www.sharepoint.com</my:field17>

public void AddCategoryRow( string 类别,字符串 SkillLink)

publicvoid AddCategoryRow(string Cate,string SkillLink)

        {

;   字符串 myNamespace = NamespaceManager.LookupNamespace("my" );

           string myNamespace = NamespaceManager.LookupNamespace("my");

;   使用( XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode(

           using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode(

;  "/my:myFields" ,NamespaceManager).AppendChild())

          "/my:myFields", NamespaceManager).AppendChild())

;    {

;       writer.WriteStartElement("group43" , myNamespace);

                writer.WriteStartElement("group43", myNamespace);

;       writer.WriteElementString("field13" , myNamespace,Cate);

                writer.WriteElementString("field13", myNamespace, Cate);

;       writer.WriteElementString("field17" , myNamespace, SkillLink );

                writer.WriteElementString("field17", myNamespace, SkillLink);

;       writer.WriteEndElement();

;       writer.Close();                

                writer.Close();               

;    } }

大师

推荐答案

您可以尝试吗?

 XPathNavigator ipFormNav = MainDataSource.CreateNavigator();
            XPathNavigator assnAttachURL = ipFormNav.SelectSingleNode("/my:myFields/my:URLpath", NamespaceManager);
            XPathNavigator assnAttachDisplay = ipFormNav.SelectSingleNode("/my:myFields/my:URLpath/@my:URLdisplay", NamespaceManager);

            //Update the URL path to a document on your site.
            assnAttachURL.SetValue("http://sharepointed.com/library/taco.xlsx");
            assnAttachDisplay.SetValue("taco");

以下是供您参考的主题.

http://www.sharepointed.com/2012/12/13/infopath-dynamic-hyperlink-field-c-and-code-behind /

最好的问候


这篇关于如何在重复表内为InfoPath代码创建/设置超链接的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 02:14