?
Solved

ASP .NET TextBox TextChanged Get Text?

Posted on 2012-09-18
7
Medium Priority
?
696 Views
Last Modified: 2012-09-18
Q. Anyway to get the Text value of the Textbox calling its event?

     protected void txt_TextChanged(object sender, EventArgs e)
     {
         e.Text ?????
     }
0
Comment
Question by:pointeman
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 38409367
protected void txt_TextChanged(object sender, EventArgs e)
     {
         string myString = txt_Text.text ;
     }
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38409368
you can get the text using txt.Text

protected void txt_TextChanged(object sender, EventArgs e)
     {
 txt.Text        
}
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 38409375
yeah I meant

protected void txt_TextChanged(object sender, EventArgs e)
     {
         string myString = txt.text ;
     }
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 38410333
Have Autopostback="true"  on textbox to fire  event .
  <asp:TextBox ID="txt" Runat="server" AutoPostBack="true" OnTextChanged="txt_TextChanged"></asp:TextBox>

Open in new window

0
 

Author Comment

by:pointeman
ID: 38410604
How bout this: ((TextBox)sender).Text
0
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 2000 total points
ID: 38410642
Yes, this is also going to work the same way as others suggested . but i feel there's no need for casting  unless your are creating textbox dynamically .
protected void txt_TextChanged(object sender, EventArgs e)
    {
        string getText = ((TextBox)sender).Text;
        Response.Write(getText);

    }

Open in new window

0
 

Author Closing Comment

by:pointeman
ID: 38411374
Thx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question