从模型弹出窗口获取Fileuploader的值 [英] Get Value of Fileuploader from model popup
问题描述
我有一个带有模型弹出扩展器的aspx页面。它包含FileUploader.I在上传时需要Progrss栏,但我没有得到fileuploader的值。它正在给0.Their没有单独的子页面和父页面。我用过仅在父页面上模型弹出扩展器..
I have a aspx page with model popup extender.And that contains FileUploader.I want Progrss bar while Uploading but i am not getting value of fileuploader.It is giving 0.Their are no separate child and parent page.I have used model popup extender on parent page only..
<asp:ModalPopupExtender ID="mpnlPopup" runat="server" TargetControlID="btnModalTarget"
PopupControlID="Panel2" BackgroundCssClass="modalBackground" DropShadow="false"
OnOkScript="onOk()" DynamicServicePath="" Enabled="True" RepositionMode="RepositionOnWindowResize"
CancelControlID="btnCloseImage">
</asp:ModalPopupExtender>
现在此弹出控件ID包含面板
Now This Popup Control Id contains panel
<asp:FileUpload ID="UploadImage" runat="server" Width="200px" CssClass="appfileupload" />
<asp:Button ID="btnUpload" runat="server" Text="Save" CausesValidation="true" ValidationGroup="CheckImage" OnClick="btnUpload_OnClick" OnClientClick="return ProgressBar()" />
<asp:Button ID="btnCloseImage" runat="server" Text="Close" />
现在 OnClientClick =return ProgressBar()
转到function.bUT UploadImage.ClientID
VALUE为0.如何获得此值并使我的进度条处于工作状态
Now OnClientClick="return ProgressBar()"
goes to the function.bUT UploadImage.ClientID
VALUE is 0.hOW TO GET THIS VALUE AND MAKE MY PROGRESS BAR IN WORKING CONDITION
<script language="javascript" type="text/javascript">
var size = 2;
var id = 0;
function ProgressBar() {
alert("in");
var ID = $("<%#UploadImage.ClientID %>").parent.valueOf();
alert(id);
if (document.getElementById('<%#UploadImage.ClientID %>').value != "") {
alert("va");
document.getElementById("divProgress").style.display = "block";
document.getElementById("divUpload").style.display = "block";
id = setInterval("progress()", 20);
return true;
}
else {
alert("Select a file to upload");
return false;
}
}
function progress() {
size = size + 1;
if (size > 299) {
clearTimeout(id);
}
document.getElementById("divProgress").style.width = size + "pt";
document.getElementById("<%#lblPercentage.ClientID %>").firstChild.data = parseInt(size / 3) + "%";
}
</script>
已添加 pre
标签。
[/编辑]
推荐答案
( <%#UploadImage.ClientID%>)。parent.valueOf();
alert(id);
if ( document .getElementById(' <%#UploadImage.ClientID%>')。value!= ){
alert( VA跨度>);
document .getElementById( divProgress).style.display = block;
document .getElementById( divUpload).style.display = block;
id = setInterval( progress(), 20 跨度>);
return true ;
}
else {
alert( 选择要上传的文件);
return false ;
}
}
function progress(){
size = size + < span class =code-digit> 1 ;
if (size> 299 ){
clearTimeout(id);
}
document .getElementById( divProgress)。style.width = size + pt;
document .getElementById( <% #lblPercentage.ClientID%>)。firstChild.data = parseInt (size / 3 )+ %;
}
< / script>
("<%#UploadImage.ClientID %>").parent.valueOf(); alert(id); if (document.getElementById('<%#UploadImage.ClientID %>').value != "") { alert("va"); document.getElementById("divProgress").style.display = "block"; document.getElementById("divUpload").style.display = "block"; id = setInterval("progress()", 20); return true; } else { alert("Select a file to upload"); return false; } } function progress() { size = size + 1; if (size > 299) { clearTimeout(id); } document.getElementById("divProgress").style.width = size + "pt"; document.getElementById("<%#lblPercentage.ClientID %>").firstChild.data = parseInt(size / 3) + "%"; } </script>
已添加 pre
标签。
[/编辑]
这篇关于从模型弹出窗口获取Fileuploader的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!