I have a ASP Page that allow the users to Download a File @ the Click of the button the File Download Dialog Box will pop up on the Scream ,on the download dialog Box are 4 buttons namely Open ,Save,Cancel and More Info :mrgreen: ,How do I disable any Button on the Dialog box let say the Save button?????? :mrgreen:

Recommended Answers

All 9 Replies

You can not disable the boxes. They are part of the browser and there is nothing you can do to disable them.

No code in the world can disable them.

Two comments.

First, I haven't seen the "More" button you mention (running IE 7, XP Professional SP2).

Second, scouring the Web brought me no idea of how to control the buttons individually.

However, regarding Open, I noticed that a client OS that was not configured to recognize the file type being downloaded would not know which environment to open, and therefore would not display the "Open" button--for example, the client displayed the download-file name in the File Download Box but Windows did not seem to recognize .doc files, therefore Windows didn't open the file in Word and did not display the Open button, only Save and Cancel.

Also, I did find some C# code that purported to suppress the Open. VB.NET seemed to recognize the code without changes except dropping the final semicolon. It didn't do the job in my app that the author claimed it did in his, but here's the code:

Response.Cache.SetCacheability (HttpCacheability.NoCache);

So, to second what Drew said--there's no way to control the buttons individually. But there's the exception that Open will appear, or not appear, depending on whether the browser recognizes your file type.

Hi
Can you please give me the codes of the "download Dialogue box' I need to put in on my page so that the user can download a pdf file.

Hi there,
I too am looking for the codes of the download dialog box. Did you get a reply or and answer?

i am too looking for the code for file downloading dialog box asp.net using vb.
if any one could help me with it.
thank you

how i can put download link for image,flash file,other file in my webpage that can other download it ?

how i can put download link for image,flash file,other file in my webpage that can other download it ?

Try

Dim FilePath As String = Server.MaPath(Folder+filename)
           Dim FileName As System.IO.FileInfo = New System.IO.FileInfo(FilePath & "\" & lblFileName.Text)
            '  If FileName.Exists Then
            Response.Clear()
            Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName.Name)
            Response.AddHeader("Content-Length", FileName.Length.ToString())
            Response.ContentType = ReturnExtension(FileName.Extension.ToLower()) '"image/jpeg"
            Response.WriteFile(FileName.FullName)
            Response.End()

            'Else
            'Response.Write("This file does not exist.")


            'End If
        Catch ex As Exception
            lblMsg.Text = ex.Message
        End Try
' Sub for extension
Public Function ReturnExtension(ByVal fileExtentsion As String) As String
        Select Case fileExtentsion
            Case ".html", ".htm"
                Return "text/HTML"
            Case ".txt"
                Return "text/plain"
            Case ".doc"
                Return "application/ms-word"
            Case ".tiff"
            Case ".tif"
                Return "image/tiff"
            Case ".asf"
                Return "video/x-ms-asf"
            Case ".avi"
                Return "video/avi"
            Case ".zip"
                Return "application/zip"
            Case ".xls"
            Case ".csv"
                Return "application/vnd.ms-excel"
            Case ".gif"
                Return "image/gif"
            Case ".jpg"
            Case "jpeg"
                Return "image/jpeg"
            Case ".bmp"
                Return "image/bmp"
            Case ".wav"
                Return "audio/wav"
            Case ".mp3"
                Return "audio/mpeg3"
            Case ".mpg"
            Case "mpeg"
                Return "video/mpeg"
            Case ".rtf"
                Return "application/rtf"
            Case ".asp"
                Return "text/asp"
            Case ".pdf"
                Return "application/pdf"
            Case ".fdf"
                Return "application/vnd.fdf"
            Case ".ppt"
                Return "application/mspowerpoint"
            Case ".dwg"
                Return "image/vnd.dwg"
            Case ".msg"
                Return "application/msoutlook"
            Case ".xml"
            Case ".sdxl"
                Return "application/xml"
            Case ".xdp"
                Return "application/vnd.adobe.xdp+xml"
            Case Else
                Return "application/octet-stream"
        End Select


    End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.