How to put tags in a textbox by Asp.net?

Asked

Viewed 201 times

0

I tried with Bootstrap like this:

<!-- Bootstrap Modal Dialog -->
<div class="modal fade open" id="myModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog">

        <div class="modal-content">
            <div class="modal-header" >
                <button type="button" class="close" data-dismiss="modal"  aria-hidden="true">&times;</button>
                <h4 class="modal-title">
                    <asp:Label ID="lblModalTitle" runat="server" Text="Enviar arquivos"></asp:Label></h4>
            </div>
            <div class="modal-body">
                <asp:FileUpload ID="FileUp" AllowMultiple="true" runat="server" />
                <br />

                Tag:<asp:TextBox ID="tbTag"  runat="server" CssClass="form-control" ClientIDMode="Static"></asp:TextBox>

            </div>
            <div class="modal-footer">
                <asp:Button runat="server" CssClass="btn ui-icon-cancel small" ID="UpluodButton" OnClick="UploadButton_Click" Text="Enviar" />

            </div>
        </div>
    </div>
</div>

And the next script in the <head>:

<script>
    $(function () {
        $('#<%=tbTag.ClientID%>').tbTag({
            autocomplete: {
                source: ['red', 'blue', 'green', 'yellow', 'violet', 'brown', 'purple', 'black', 'white'],
                delay: 100
            },
            showAutocompleteOnFocus: true
        });
    }
</script>

But it doesn’t work.

<script type="text/javascript" src="../Scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../Scripts/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap.min.js"></script>

Reference: http://jquery-plugins.net/tokenfield-jquery-tag-token-plugin-for-bootstrap

  • How are you referencing Bootstrap and Tokenfield?

  • What about the Tokenfield references you want to use? Open the browser console, and check for errors.

  • Uncaught Typeerror: Undefined is not a Function

  • in javascript la, for ta inside the head, below the references of js.

  • the line error $('#<%=tbTag.Clientid%>'). tbTag({

  • placed and now appears this: Uncaught Syntaxerror: Unexpected end of input

  • @Renilsonandrade pq erased the answer?

  • what other way you said you could solve?

  • I cannot say why they deleted the answer. And I did not follow, to know what the answer was about.

  • tu Falu do ctl00$Contentplaceholder1$tbTag, coloco?

  • @Renilsonandrade as well as tokenfield references? what is this?

  • I’ve referenced tokenfield and nothing

  • @Warlock The error by not closing $() in the Javascript code was caused when pasting the code here in the question?

Show 10 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.