如何在Acumatica中获取文本框值

时间:2019-06-28 05:55:33

标签: c# asp.net acumatica

您好,Acumatica开发中的新手

所以我试图通过pxaction按钮单击来获取文本框的值

图像中外部链接的值就是我想要得到的

图片1:

Image

图片2:

Image2

公共PXAction AddtoLazada;

[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Add image to Lazada")]
protected virtual void addtoLazada()
{          
        UploadFileWithIDSelector getval = new UploadFileWithIDSelector();
        var externalval = getval.ExternalLink.ToString();
}

但是我没有将对象引用设置为实例

1 个答案:

答案 0 :(得分:0)

此处getval.ExternalLink的值为。您会收到此异常,因为您为ToString()对象调用了null

    public PXAction<UploadFileWithIDSelector> AddtoLazada;
    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Add image to Lazada")]
    public virtual IEnumerable addtoLazada(PXAdapter adapter)
    {
        if (this.Base.Files.Current != null)
        {
            var externalval = this.Base.Files.Current.ExternalLink;
        }
        return adapter.Get();
    }