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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:23:36+00:00 2026-06-14T14:23:36+00:00

Problem: I have an asp.net Textbox that I am putting text into and on

  • 0

Problem: I have an asp.net Textbox that I am putting text into and on text change it should assign its value to a variable, this does not happens.

Question: What is the best method to retrieve the value from the Textbox?

C# Code:

protected void btnSourceConnect_Click(object sender, EventArgs e)
{
    if (Util.Connection(SourceString, 0))
    {
        lblTesting.Text = "Working!";
    }
    else
    {
        lblTesting.Text = "It No Work";
    }
}
protected void txtSourceServer_TextChanged(object sender, EventArgs e)
{
        SourceString.DataSource = txtSourceServer.Text;      
}

protected void txtSourceDatabase_TextChanged(object sender, EventArgs e)
{

        SourceString.InitialCatalog = txtSourceDatabase.Text;

}

protected void txtSourceUN_TextChanged(object sender, EventArgs e)
{

        SourceString.UserID = txtSourceUN.Text;

}

protected void txtSourcePass_TextChanged(object sender, EventArgs e)
{

        SourceString.Password = txtSourcePass.Text;   
}

Asp.Net Code:

<table style="width: 100%;Border:1px solid Black;">
    <tr>
            <td class="style1">
                &nbsp;
                Source Server:</td>
            <td class="style1">
                &nbsp;&nbsp;
                <asp:TextBox ID="txtSourceServer" runat="server" 
                    ontextchanged="txtSourceServer_TextChanged" AutoPostBack="True"></asp:TextBox>
            </td>
            <td class="style1">
                &nbsp; Source Database:
            </td>
            <td class="style1">
                &nbsp;&nbsp;
                <asp:TextBox ID="txtSourceDatabase" runat="server" 
                    ontextchanged="txtSourceDatabase_TextChanged" AutoPostBack="True"></asp:TextBox>
            </td>

        </tr>
        <tr>
            <td class="style1">
                &nbsp; User Name:
            </td>
            <td class="style1">
                &nbsp;&nbsp;
                <asp:TextBox ID="txtSourceUN" runat="server" 
                    ontextchanged="txtSourceUN_TextChanged" AutoPostBack="True"></asp:TextBox>
            </td>
            <td class="style1">
                &nbsp; Password:
            </td>
            <td class="style1">
                &nbsp;&nbsp;
                <asp:TextBox ID="txtSourcePass" runat="server" 
                    ontextchanged="txtSourcePass_TextChanged" AutoPostBack="True"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                &nbsp;
            </td>
            <td class="style1">
                &nbsp;
                <asp:Button ID="btnSourceConnect" runat="server" Text="Test Connection" 
                    onclick="btnSourceConnect_Click" />
            </td>
        </tr>
        </table>
  • 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-14T14:23:38+00:00Added an answer on June 14, 2026 at 2:23 pm

    What is the best method to retrieve the value from the Textbox?

    The best method is like this control I am writing right now, you have a button that make post back, and then you read the value of the text box on code behind – on post back.

    Using the AutoPostBack="True" on every TextBox you use involves too many unnecessary post backs to the server, it is better to use a “submit” button and save all your values when the user click on submit.

    In you case you have a button, and you only need to remove the auto post back and set your values only when you try to connect as:

    protected void btnSourceConnect_Click(object sender, EventArgs e)
    {
        SourceString.UserID = txtSourceUN.Text;
        SourceString.DataSource = txtSourceServer.Text;      
        SourceString.InitialCatalog = txtSourceDatabase.Text;
        SourceString.Password = txtSourcePass.Text;   
    
        if (Util.Connection(SourceString, 0))
        {
            lblTesting.Text = "Working!";
        }
        else
        {
            lblTesting.Text = "It No Work";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the problem is that I do have an ASP.NET TextBox in a FormView with
I'd like to have an asp.net textbox that people can paste content into and
I have problem while using jquery maskedinput with asp.net textbox. I have a check
i have an asp.net form and an asp:textbox. i have a problem when the
I have the following problem in ASP.NET: there is a form that contains a
I have an asp.net textbox which is disabled and I am setting the value
i have a regular expression on ASP.net textbox control that validate for user input
I have a problem with an ASP.NET MVC page that shows a list of
I have an asp.net textbox that is disabled: <asp:TextBox ID=txtEmpName runat=server Enabled=false></asp:TextBox> Using jQuery,
i have a problem with jquery and asp.net (the viewstate) i have a asp.net

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.