Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6369119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:45:44+00:00 2026-05-25T00:45:44+00:00

I have a couple upload controls on my page that are being shown by

  • 0

I have a couple upload controls on my page that are being shown by the ajax ModalPopUpExtender, but they don’t work at the moment. Can someone help me figure out what is wrong so that they can start getting information into my database?

By the way, I don’t know what the hidden field is for or is doing, so if someone understands that, please explain it to me. I didn’t write this, I’m just trying to fix it.

       <!-- Add a Document -->
    <li>
        <asp:LinkButton ID="DocumentButton" runat="server">Document</asp:LinkButton>
        <asp:Panel ID="DocumentPanel" runat="server" CssClass="modalPopup" Style="display:none">
            <asp:FileUpload ID="DocumentUpload" runat="server" />
            <asp:Button ID="SubmitDocument" runat="server" Text="Upload" onclick="SubmitDocument_Click" /><asp:Button ID="CancelDocument" runat="server" Text="Cancel" /><asp:HiddenField ID="filename" runat="server" />
        </asp:Panel>       
        <asp:ModalPopupExtender ID="DocumentModal" runat="server" DropShadow="True" 
            DynamicServicePath="" Enabled="True" OkControlID="SubmitDocument" PopupControlID="DocumentPanel" TargetControlID="DocumentButton"></asp:ModalPopupExtender>
    </li>

    Protected Sub SubmitDocument_Click(ByVal sender As Object, ByVal e As EventArgs) Handles SubmitDocument.Click
    'Builds the full absolute URL to be inserted into the database. 
    Dim hostURL As String = Request.Url.Scheme & "://" & Request.Url.Host & ":" & Request.Url.Port & Request.ApplicationPath
    Dim sqlFileHREF As String = "INSERT INTO Marketing (ProductID, MarketingTypeID, MarketingTitle, MarketingData) VALUES (" & ProductID.Value & " , 4 , '" & LinkTitle.Text & "', '" & hostURL & "uploads/" & ProductID.Value & "/" & filename.Value & "')"
    'Create SQL Connection
    Dim SqlConnection As New SqlConnection("Server=off-db1;uid=productsDB_admin;pwd=*****;database=Products")
    SqlConnection.Open()
    Dim sqlCommand As New SqlCommand(sqlFileHREF, SqlConnection)
    sqlCommand.ExecuteNonQuery()
    SqlConnection.Close()
    Response.Redirect(Request.RawUrl)
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:45:44+00:00Added an answer on May 25, 2026 at 12:45 am

    setting OkControlID="SubmitDocument" in the ModalPopupExtender prevent the Click event of the SubmitDocument Button to be raised on the server-side.

    first thing to try is to remove it and add a DocumentModal.hide() in the SubmitDocument_Click Sub.

    Update :
    Then you could add a watch to sqlFileHREF to find what is causing the Incorrect syntax near ','. I suspect that you have a quote or others specials character in it. You could do somthing like sqlFileHREF.Replace("'", "''") to double your quotes.

    Note : Executing SQL code like this make you vulnerable to SQL Injection!

    Note 2 : It would be wise to remove the password from the connection string and replace it with stars in yours future posts (pwd=********) (you should edit this one)

    Update 2 :
    Use DocumentUpload.FileName instead of filename.Value, it look like the filename HiddenField was there for some unimplemented feature or testing purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen a couple of questions that have been resolved but none are
I have a couple of solutions, but none of them work perfectly. Platform ASP.NET
i have an upload script with that i like to upload a couple of
I have couple of dozen pieces of data that I need to save and
I have couple resource DLLs that I currently load when application starts using following
We have couple different web-apps that share the same db link. The hibernate layer
ok I have couple of .NET classes that I want to use in VBA.
to those that may have read my previous question that got solved a couple
Here's a sample page with a couple datepickers. Here's the Drip result for that:
I have been developing an upload site for a couple of months now, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.