Javascript on user control
Javascript on user control
In my jQuery DataTable I use asp custom user control and i added it like this:
"columns": [ {
"className": "dataTableActionColumn",
"data": null,
"defaultContent": '<uc1:PatientActionsAjaxControl runat='server' ID='ucPatientActionsAjaxControl' />'
}]
ucPatientActionsAjaxControl has some buttons and it works fine until I added html tags for javascrpt.
<script type='text/javascript'></script>
I got a SyntaxError: unterminated string literal
I need javascript because bootstrap.js functionality doesn't work, so i wont to try to insert it on this user control.
$("[data-toggle=popover]").popover({
html: true,
content: function () {
return $('#someDiv').html();;
}
});
This bootstrap code works when i click on button on page, but it doesn't work when I click on button in user control.
Any suggestion?
Answers
This is not valid Javascript due to the quote marks:
You'd need to use:
Or change the outer set to double quotes.
Allan
But it works fine with this. I have problem with adding
<script type='text/javascript'></script>
on user control. My user control look like:Did you fix the quote issue Allan mentioned above?
Kevin
Yes, but in that case it doesn't work at all... "Parser Error Message: The server tag is not well formed."
Well, I guess without being able to see what's going on it will be difficult to help with just code snippets. Can you post a link to your page or provide a test case showing the issue.
Seems to me that you have a syntax error in your HTML. Maybe the W3C Validator to verify your syntax.
Kevin
I don't know how to make custom user control with test case. Maybe you have solution why button click doesn't work on user control, but bootstrap.js is loaded and it works on .apsx page? (To open new topic for this question?)
This is loaded on document ready on aspx form...
Thanks Dado
Very likely because there is not
data-toggle=popover
element on the page when that code is run. If the table's data is being ajax loaded, you'd need to run that code once the table has been drawn -drawCallback
for example can help with this.Allan
I made it very simply. OnClick="SomeFunction()"
Thanks