hi
I have done the following piece of code .
<asp:Label ID="lblUploadW9" runat="server" Text="Upload W-9" /><span class="reqd">*</span>
</div>
<div class="sxlm">
<asp:FileUpload ID="fupUploadW9" runat="server" />
<div class="vldx">
<asp:Label runat="server" ID="lblUploadW9FileName" Text="" Style="word-break: hyphenate;"></asp:Label>
<asp:CustomValidator class="errmsg" ID="cusUploadW9" runat="server" ValidationGroup="grpSupAccData"
Display="Dynamic" ClientValidationFunction="validateUploadW9" OnServerValidate="cusUploadW9_ServerValidate" />
</div>
</div>
the jav ascript is :
function validateUploadW9(source, e)
{
var fileName = FSObject.$("[id$=fupUploadW9]")[0].value;
var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
if (fileName == "")
{
var length = FSObject.$("[id$=lblUploadW9FileName]").length;
if (FSObject.$("[id$=lblUploadW9FileName]")[length - 1].innerHTML == "")
{
e.IsValid = false;
}
else
{
if (fileExtension != ".doc" || ".DOC " || ".txt" || ".docx" || ".DOCX" || ".TXT" || ".xls" || ".xlsx" || ".XLS" || ".XLSX" || ".pdf" || ".PDF")
{
FSObject.$("[id$=cusUploadW9]")[0].innerHTML = "Invalid extension, only .doc, .docx, .txt, .xls, .xlsx, .pdf and .jpg extensions are supported";
e.IsValid = false;
}
else
{
e.IsValid = true;
}
}
}
else {
if (fileExtension != ".doc" || ".DOC " || ".txt" || ".docx" || ".DOCX" || ".TXT" || ".xls" || ".xlsx" || ".XLS" || ".XLSX" || ".pdf" || ".PDF")
{
FSObject.$("[id$=cusUploadW9]")[0].innerHTML = "Invalid extension, only .doc, .docx, .txt, .xls, .xlsx, .pdf and .jpg extensions are supported";
e.IsValid = false;
}
else
{
e.IsValid = true;
}
}
}
everything works fine,but the problem is that on entering invalid file type the message gets displayed wrapped with the file-upload control,I want the message to be displayed at the next line,without using
tag.