Recently I was working with dynamic controls where I got in to a small issue where I need to provide parameters in JavaScript function. I tried lots of things , But here is the approach which solved my issue:
Example:
sb.AppendLine(@"<li><a href='#' onclick='FunctionTest(" + "\"" + string1 + "\" ,\"" + string2+ "\"," + int1 + ")'>" + string4 + "</a></li>");
Explanation:
We can divide above code in following parts:
1) sb.AppendLine(@"<li><a href='#' onclick='FunctionTest(" completes first string
2) + "\"" + string1 + "\" Adds " string1 " (string parameter) to function
3) " + int1 + " Adds int1 (integer parameter) to function
4) )'>" + string4 + "</a></li>"); Complete remaining string
Subscribe to:
Post Comments (Atom)
-
In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use...
-
One of our client wanted to show Employee Directory and our first suggestion was to build custom SPFx which will fetch data from Azure AD or...
-
Recently I was working on sending mail using smtp server where I stuck on below error: IIS/SMTP - emails are stuck in mailroot/Queue ...
No comments:
Post a Comment