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 8916713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:18:47+00:00 2026-06-15T05:18:47+00:00

I am using Ajax Autocomplete to look up student names and return the student

  • 0

I am using Ajax Autocomplete to look up student names and return the student ID. My update panel looks like this:

<asp:UpdatePanel ID="StudentSearchUpdatePanel" runat="server">
    <ContentTemplate>
        <dl>
            <dt>Enter student ID:</dt>
            <dd>
                <asp:TextBox ID="StudentIDTextBox" runat="server" Wrap="False" MaxLength="6"></asp:TextBox>
                <asp:Button ID="SelectStudentIDButton" runat="server" Text="Select" OnClick="SelectStudentIDButton_Click"  />
                <asp:Label ID="StudentIDEntryError" runat="server" Visible="false" Font-Bold="True" ForeColor="Red" Text="Please enter a 6-digit student ID number."></asp:Label>
            </dd>
            <dt>Or, begin typing student last name:</dt>
            <dd><asp:TextBox ID="StudentNameSearchTextBox" runat="server"></asp:TextBox></dd>
        </dl>


        <ajaxToolkit:AutoCompleteExtender ID="StudentNameSearchTextBox_AutoCompleteExtender" runat="server"
            TargetControlID="StudentNameSearchTextBox" 
            ServiceMethod="GetStudents"
            OnClientPopulated="getStudents_Populated_Json"
            OnClientItemSelected="selected_Student" 
            MinimumPrefixLength="2" 
            CompletionSetCount="20" 
            UseContextKey="True" >
        </ajaxToolkit:AutoCompleteExtender>
    </ContentTemplate>
</asp:UpdatePanel>

GetStudents_Populated_Json looks like this:

    function getStudents_Populated_Json(sender, e) {
        var students = sender.get_completionList().childNodes;
        for (var i = 0; i < students.length; i++) {
        var student = eval('(' + students[i]._value + ')');
         students[i].innerHTML = student.LastName + ' ' + student.FirstName;
      }

And finally, selected_student:

 function selected_Student(sender, e) {    
      var selectedStudent = eval("(" + e._value + ")");  
 }

In selected_student I want to find the ID of the UpdatePanel (StudentSearchUpdatePanel) so I can in turn find “StudentIDTextBox” and place selectedStudent.ID in StudentIDTextBox.innerHTML.
How do I identify the StudentIDTextBox and set it’s innerHTML from selected_Student?

(the student class is ID, FirstName, LastName. I have verified that selectedStudent.ID gives an acurate id).

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-15T05:18:48+00:00Added an answer on June 15, 2026 at 5:18 am

    An easier solution would be to make it easy to find the ID of the textbox you want if the first place.

    One way of doing this would be to use ClientIDMode="Static" on your asp:TextBox. This will force the control of having the same id attribute on the client as the server name for the control. That way, to find this control on the client (using JS), you would just:

    var myTextbox = document.getElementById('StudentNameSearchTextBox');
    myTextbox.value = student.LastName + ' ' + student.FirstName;
    

    Hope that helps.

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

Sidebar

Related Questions

I am using a JQuery autocomplete AJAX plugin as follows; $(document).ready(function() { $(#myfield).autocomplete({ serviceUrl:'autocomplete.asp?soc='
I am using the AJAX autocomplete add-on to the <asp:textbox> control. I have everything
I'm using AJAX to get data for several business-card like divs on my page
I am creating a user control in ASP.NET (using VB) that uses the autocomplete
What's benefit using jQuery Autocomplete over Ajax AutoCompleteExtender? Can some one explains the benefits
I'm using the jQuery Autocomplete control to autocomplete from the server via an AJAX
Using the Ajax helper for CakePHP (currently 1.2.3.8166) to provide an $ajax->autoComplete list of
I've been using Editor-Templates in the past like this, by applying the following data
I've tried using merge and extend to combine arrays inside an Autocomplete ajax option
I'm using jquery ajax to fetch data from an asp.net webservice. I'm wondering how

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.