How to get asp:text box value ?

Posted by Abhisekjani under ASP.NET on 10/19/2012 | Points: 10 | Views : 1672 | Status : [Member] | Replies : 5
Hi
in my page i have a asp:textbox controls but i am unable to get the value
my code is below
<asp:TextBox ID="text1" runat="server"
ontextchanged="text1_TextChanged" TextMode="MultiLine"
Width="200px"></asp:TextBox>

but in code behind text1.text it not taking the user input text it always shows blank
so how to get the textbox value




Responses

Posted by: Gow.Net on: 10/19/2012 [Member] Starter | Points: 25

Up
0
Down
please show me your coding

gowthaman8870226416

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vasanthmvp on: 10/19/2012 [Member] Starter | Points: 25

Up
0
Down
Post your Codebehind code also.
In the page_load method, did you include anything related to textbox.. i think it is getting cleared off.

Regards,

Awesome Coding !! :)

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 10/20/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi
Abhisekjani

try this code

client Side

<asp:TextBox ID="text1" runat="server" AutoPostBack ="true"
ontextchanged="text1_TextChanged" TextMode="MultiLine"
Width="200px"></asp:TextBox>


Server Side

protected void text1_TextChanged(object sender, EventArgs e)
{
Response.Write(text1.Text);
}


this is working in my pc see this image file also
 Download source file

Mark as Answer if its helpful to you

Kumaraspcode2009@gmail.com

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhupentiwari on: 10/20/2012 [Member] Starter | Points: 25

Up
0
Down
it is working in my pc also....

Thanks n Regards
Bhupendra Tiwari

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh07 on: 10/20/2012 [Member] Starter | Points: 25

Up
0
Down
Hi..

if you want to see the output of this event.....

try to postback the page after inputing the text in the Textbox..

eg: 1st enter the text in the textbox then after click on the button if it is on the page to postback the page...then it will show your output....:-)

Sourabh07

Abhisekjani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response