Click here to Skip to main content
15,896,367 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a text box inside data list but I cant the get value of text box code is:
TextBox Comment = (TextBox)e.Item.FindControl("TextBox1");
string a = Comment.Text;

I write this code on item_command but I did't get the value
every time i get null value
Posted
Updated 4-Sep-14 20:39pm
v2
Comments
Gihan Liyanage 4-Sep-14 4:37am    
Better to have corresponding parts of the code...
ChintanShukla 5-Sep-14 2:52am    
Can you share more of your Code.

1 solution

If you are binding Datalist in Page_Load, make sure to bind the Datalist inside if (!this.IsPostBack){//Bind Datalist here }. Otherwise datalist will be refreshed on every event and the data entered inside any control will be lost.
 
Share this answer
 
v2
Comments
Rahulmishra011 5-Sep-14 4:41am    
thanku
i use (!this.IsPostBack) this i got tha value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900