我在我的項目中使用Devexpress UploadControl for MVC。我正在使用彈出窗口來上傳放置文件上傳控件的文件。如果我單擊按鈕以不止一次觸發該彈出窗口,則上傳控件文本顯示爲「未定義」。這個問題只發生在谷歌瀏覽谷歌瀏覽器中的DevExpress UploadControl javascript錯誤
見acreenshot
爲UploadControl該代碼是用來如下:
<dl class="uploadProviderDoc">
@Html.DevExpress().UploadControl(settings =>
{
settings.Name = "Document";
settings.ClientSideEvents.TextChanged = "function(s,e){$('label[for=lblUploadMsg]').html(' ');}";
}).GetHtml()
@Html.Label("lblUploadMsg", " ")
</dl>
我檢查的谷歌瀏覽器的控制檯和發現的代碼行其拋出錯誤。
RedefineInputAttributes: function(textBoxCell, index, isNewElement) {
textBoxCell.id = this.GetTextBoxCellID(index);
if(this.IsSlUploadHelperEnabled()) {
if(this.GetSlUploadHostElement())
this.slUploadHelper.RedefineSlObjectAttributesInHostElement(index + 1, index, isNewElement);
else
this.slUploadHelper.RedefineSlObjectAttributes(textBoxCell, index, isNewElement);
}
else {
var inputElement = _aspxGetChildByTagName(textBoxCell, "INPUT", 0);
inputElement.id = textBoxCell.id + ASPxClientUploadControlIDSuffix.FileInput;
//Uncaught TypeError: Cannot set property 'id' of null (This exception is thrown here)
inputElement.name = inputElement.id;
}
var fakeInputElement = _aspxGetChildByTagName(textBoxCell, "INPUT", this.IsSlUploadHelperEnabled() ? 0 : 1);
if(fakeInputElement)
fakeInputElement.id = textBoxCell.id + ASPxClientUploadControlIDSuffix.FileFakeInput;
}
是的,我正在使用jQuery – Prasanth
您可以通過刪除jQuery並確定是否仍然將'undefined'作爲控件文本來確保它是兼容性問題。 – shamp00