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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:42:46+00:00 2026-06-06T21:42:46+00:00

I am applying the following onclick event to a vb.net button in the server

  • 0

I am applying the following onclick event to a vb.net button in the server side code. I need the query string to contain the content of the products data attribute that I am assigning to btnGenerate.

I am getting the error in my Title when I click btnGenerate, I think it has something to do with my use of various quotation marks.

Changing the single apostrophes around #btnGenerate and products to double quotation marks results in the text: “$(“#btnGenerate”).data(“products”);” appearing in my query string instead of the values it should be retrieving.

Me.btnGenerate.Attributes.Add( _
    "onclick", _
    "return OpenPrinterFriendly('DespatchLabel.aspx?salesordernumber=" & _
    e.CommandArgument.ToString & " &newprocessdate=" & hdnNewProcessDate.Value & _
    "&products=$('#btnGenerate').data('products');')")
  • 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-06-06T21:42:47+00:00Added an answer on June 6, 2026 at 9:42 pm

    You need to escape your single quotes within the string with \ character:

    Me.btnGenerate.Attributes.Add("onclick", 
        "return OpenPrinterFriendly('DespatchLabel.aspx?salesordernumber=" & _
        e.CommandArgument.ToString & "&newprocessdate=" & hdnNewProcessDate.Value & _
        "&products=$(\'#btnGenerate\').data(\'products\');')")
    

    Edit:

    For retrieving the values using jQuery, you need to have this (similar to Konrad‘s response, although he’s missing a + sign:

    Me.btnGenerate.Attributes.Add("onclick", 
        "return OpenPrinterFriendly('DespatchLabel.aspx?salesordernumber=" & _
        e.CommandArgument.ToString & " &newprocessdate=" & hdnNewProcessDate.Value & _
        "&products=' + $('#btnGenerate').data('products'));")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following content slider slider . For its forward and back button
Is it possible to applying some sort of onClick event on the XML nodes?
So I'm applying an image mask to a UIView layer with the following code:
I have following html in string and i have to extract the content only
I'm applying the following filter to my data. string[] options = new string[2]; options[0]
Hello I have the following code to generate my navigation/page menu along with applying
I am following the tutorial here: http://www.aspfree.com/c/a/XML/Applying-XSLT-to-XML-Using-ASP.NET/2/ The tutorial shows how one converts xml
I have the following code: http://jsfiddle.net/LvdcU/3/ I don't understand why I keep getting the
I'm applying the following example http://jsoup.org/cookbook/extracting-data/example-list-links to list links. package org.jsoup.examples; import org.jsoup.Jsoup; import
I'm applying an XSLT stylesheet to the following XML file: <top xmlns=http://www.foo.com/bar> <elementA />

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.