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');')")
You need to escape your single quotes within the string with
\character:Edit:
For retrieving the values using jQuery, you need to have this (similar to Konrad‘s response, although he’s missing a
+sign: