Link to home
Start Free TrialLog in
Avatar of pointeman
pointemanFlag for United States of America

asked on

ASP .NET TextBox TextChanged Get Text?

Q. Anyway to get the Text value of the Textbox calling its event?

     protected void txt_TextChanged(object sender, EventArgs e)
     {
         e.Text ?????
     }
Avatar of Andrew Crofts
Andrew Crofts
Flag of Ukraine image

protected void txt_TextChanged(object sender, EventArgs e)
     {
         string myString = txt_Text.text ;
     }
you can get the text using txt.Text

protected void txt_TextChanged(object sender, EventArgs e)
     {
 txt.Text        
}
yeah I meant

protected void txt_TextChanged(object sender, EventArgs e)
     {
         string myString = txt.text ;
     }
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

Avatar of pointeman

ASKER

How bout this: ((TextBox)sender).Text
ASKER CERTIFIED SOLUTION
Avatar of Rajar Ahmed
Rajar Ahmed
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thx