简体   繁体   English

Infopath 2007-如何在后面的C#代码中以编程方式设置ScreenTip?

[英]Infopath 2007 - How to set ScreenTip programmatically in C# code behind?

I need to set up infopath screentip programmatically in infopath code behind. 我需要在后面的信息路径代码中以编程方式设置信息路径屏幕提示。 I read something about this that it is impossible but, i made something like this: 我读到一些这是不可能的,但是,我做了这样的事情:

        XPathNavigator field1 = MainDataSource.CreateNavigator().SelectSingleNode(xpath1, NamespaceManager);

        XPathNavigator field2 = MainDataSource.CreateNavigator().SelectSingleNode(xpath2, NamespaceManager);

        if (field1.Value.ToString() == "none")
        {

            this.Errors.Add(field2, "XXX", "XXxxxXX", "xxXXxxXX");

        }

but still i change the field to "cannot be blank" any clue ? 但是我仍然将该字段更改为“不能为空”任何线索吗?

I faced the exact same problem like you and didn't really find an easy and clean solution. 我遇到了像您一样的完全相同的问题,却没有真正找到一种简单干净的解决方案。 I had to check if an IBAN was entered correctly. 我必须检查是否正确输入了IBAN。 Working with extra fields and methods is not clean enough for me so I went and tried it through the Errors-property, which you say doesn't work. 对我来说,使用额外的字段和方法还不够干净,因此我尝试通过Errors-property进行尝试,您说这是行不通的。 Here's the code I used: 这是我使用的代码:

XPathNavigator navigator = MainDataSource.CreateNavigator();
XPathNavigator ibanField = navigator.SelectSingleNode("/my:.../my:.../my:FldIban", NamespaceManager);
Errors.Add(ibanField , "Invalid IBAN", "The given IBAN is not formatted correctly");

Hope this helps anyway, it did for me. 希望无论如何对我有帮助。 :) :)

I created button and special field with hide when value = true , and show when is true. 当value = true时,我用隐藏创建了按钮和特殊字段,并在true时显示。

public void CTRL32_7_Clicked(object sender, ClickedEventArgs e) { // XPathNavigator test = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field11", NamespaceManager); public void CTRL32_7_Clicked(object sender,ClickedEventArgs e){// XPathNavigator test = MainDataSource.CreateNavigator()。SelectSingleNode(“ / my:myFields / my:field11”,NamespaceManager);

        XPathNavigator test2 = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:buttonSet", NamespaceManager);
        if (test2.Value == "FALSE")
        {
            test2.SetValue("TRUE");
        }
        else
        {
            test2.SetValue("FALSE");
        }
        XPathNavigator tooltip = MainDataSource.CreateNavigator().SelectSingleNode("my:myFields/my:tooltip", NamespaceManager);
        tooltip.SetValue("Custom Tooltip DEMO");
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM