Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:27:01+00:00 2026-06-01T08:27:01+00:00

Although there are a lot of jquery autocomplete code in this forum. However I

  • 0

Although there are a lot of jquery autocomplete code in this forum. However I haven’t found anything fitting to my SharePoint/ASP.NET web page case. I followed the jquery autocomplete link. It is helpful. But please look at

My code:

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>  
<script type="text/javascript">
    $(document).ready(function () {
        $("asp:TextBox#TextBox3").autocomplete({
            source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
        });
    });

</script>
 </asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<table>
      <tr><td>
        <asp:Label ID="Label4" runat="server" Text="Qode"></asp:Label></td><td>
           <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

        </td></tr>
</table>

Question

1. Can I use the code ` $("asp:TextBox#TextBox3")?`
2. If the source comes from code behind instead of hard copy strings, how to do it?

Let’s say in code behind:

        string[] source = new string[5];
        source[0] = "c++";
        source[1] = "java";
        source[2] = "php";
        source[3] = "coldfusion";
        source[4] = "javascript";

Then how to pass the array to jquery code?
Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:27:03+00:00Added an answer on June 1, 2026 at 8:27 am

    With regards to your first question, if you’re using ASP.net version 4 or higher you can set the ClientIDMode of the textbox to “static” and it will force the server to render the ClientID to be the same as the server ID. Then you can reference it normally in your jQuery code.

    Ex.

    <asp:TextBox ID="TextBox3" runat="server" ClientIdMode="static">`

    $("#TextBox3")  // select your text box with standard jQuery id selector
    

    If you’re using an older version of ASP.net, you can insert server-side code into your .aspx to access the dynamic clientID that is generated. You would add this to your jQuery selector as well, but it would be a little different.

    $("#<%= Textbox3.ClientID %>")
    

    This should render the proper client ID to the browser and be handled by jQuery.

    As for your second question, personally I would serialize the array to JSON and send that to jQuery. A good library do so is Json.Net (http://json.codeplex.com/), which has examples of how to use the library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Although there are quite a lot of Q&As regarding IDisposable to be found on
Although there are a lot of posts about .net config files, I believe that
I couldn't find a duplicate for this question for Java, although there are a
I know there are a lot of sources which explain this, but they just
There are a lot of questions about salts and best practices, however most of
Although there are some similar questions I’m having difficulties finding an answer on how
I am currently trying to create a content uploading system and although there are
I'm building a site using CodeIgniter that largely consists of static content (although there
Although the question title appears a bit subjective I am sure there is not
There is something I am trying to accomplish although I'm not really sure where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.