Well yes, it will.
Simplfying a bit:
TextBox t1 = row.FindControl("emp_name") as TextBox;
string s = "hello: " + t1;
The second line calls an implicit ToString method on the TextBox object
t1
, which returns the default object ToString implementation - which is the name of the type of the object: or "System.Web.UI.WebControls.TextBox" rather than the Text content of the textbox itself.
There are three things seriously wrong with your approach:
1) If the control name is not found, FindControl will return
null
- which will crash your webpage. You must check for this!
2) You should use the TextBox.Text property instead of the whole control.
3) Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead, or the first person anywhere in teh world who feels like it can destroy your entire database without any difficulty.