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 7032541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:56:55+00:00 2026-05-28T00:56:55+00:00

I am having trouble using JQuery with ASP.net. I have a HTML img ,

  • 0

I am having trouble using JQuery with ASP.net. I have a HTML img, an asp:Button and an asp:FileUpload.

<img src="images/12345.png" data-id="12345" />
<asp:FileUpload ID="fup" runat="server" />
<asp:Button ID="btn" runat="server" />

I am trying to pass back the picture id from the HTML img. Any idea of how I could push the data element into a CommandArgument or something?

I can’t have the HTML image runat=”server”, because I am setting it dynamically client-side.

Plugins

I tried using plugins, nothing is really working out the way I had planned:

This one takes multiple files, I need it to be limited to one. Don’t need for it to support dragging or anything fancy. http://valums.com/ajax-upload/

Uploadify uses Flash, trying to shy away from that. http://www.uploadify.com/

This one uses some ugly iframes and stuff, not looking too nice. Also, the spelling mistakes on the site are a little off-putting. http://www.phpletter.com/Demo/AjaxFileUpload-Demo/

If anyone has either a way to do what I’m asking or a slick way to upload new images (with additional parameters supported), it would be greatly appreciated.

Solution
Thanks for the answers, I ended up combining the two and using an asp:HiddenField running at the server:

Markup:

<img id="img" src="images/12345.png" data-id="12345" />
<asp:HiddenField id="hfData" runat="server" />
<asp:FileUpload ID="fup" runat="server" />
<asp:Button ID="btn" runat="server" />

JQuery:

$("#<%= hfData.ClientID %>").val($("#img").data("id"));

Codebehind:

string pictureID = hfData.Value;
  • 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-28T00:56:56+00:00Added an answer on May 28, 2026 at 12:56 am

    If i understand you correctly, you can use <input type="hidden" name="data-id" value="12345" /> to get that data-id you are looking for.

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

Sidebar

Related Questions

I'm having trouble with updating an ASP:UpdatePanel using javascript (jQuery). Here're what I have.
I'm having trouble with this simple scenario. First, I'm using ASP.NET WebForms. I'm making
I am having trouble using JQuery to work with multiple radio button groups. The
I am having a trouble using jQuery in my HTML. This might be a
Im having trouble trying to post data correctly using jQuery/AJAX I have the following...
I'm having trouble using jQuery with child page parent.html loads child.html like so: ie
I have a simple accordion menu working using jQuery but I'm having trouble styling
I'm a jquery/rails newbie and I'm having trouble using .sortable(). I have expandable rows
I am having trouble accessing the value of an HTML Input element using jQuery,
I'm using jQuery Datepicker but I'm having trouble when editing records. // js code

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.