I am using jQuery UI widget Tag it. Code which i am using is working fine but all the Tag values visible on the browser.
Code I am using is below
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../JavaScript/tag-it.js"></script>
<link href="../CSS/tagit.ui-zendesk.css" rel="stylesheet" />
<link href="../CSS/jquery.tagit.css" rel="stylesheet" />
<script>
$(function(){
var sampleTags = [<%# this.SuggestionList %>];
//var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua'];
$('#myTags').tagit();
$('#singleFieldTags').tagit({
availableTags: sampleTags,
allowSpaces: true,
singleFieldNode: $('#mySingleField')
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="content">
<p>
<input name="tags" id="mySingleField" value="Apple, Orange" disabled="true">
</p>
<ul id="singleFieldTags"></ul>
</div>
</form>
</body>
Code behind
string queryString = "select * from SIB_KWD_Library ORDER BY Keyword asc";
using (SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["vConnString"].ToString()))
{
using (SqlCommand command = new SqlCommand(queryString, connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
if (string.IsNullOrEmpty(SuggestionList))
{
SuggestionList += "\'" + reader["Keyword"].ToString() + "\'";
}
else
{
SuggestionList += ", \'" + reader["Keyword"].ToString() + "\'";
}
}
}
}
}
In browser source code all the tag keywords are visible. Something like
var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua'];
Please suggest any other way to do this.
Thanks in advance :)