Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everybody,

I'm a student.

I'm implementing a application using ASP.NET and I get an error when I fill textbox with data of gridview. Please see below:

C#
//row as GridViewRow.
txtOperatorName.Text = row.Cells[2].Text;


The GridviewRow I select have value "Lê Thánh Tiên" (Vietnamese name) but it's become "L& #234; Th& #225;nh Ti& #234;n" (no spacing between '&' and '#') in the textbox I fill in. Please tell me what problem here and how to fix it...

My English is bad and I sorry if it make you uncomfortable.

Many thanks...
Posted

Thanks, @syed shanu.

This problem is fixed by adding like below:
C#
Server.HtmlDecode(row.Cells[2].Text);


You can see here.

Hope it's useful for who get same problem like me.
 
Share this answer
 
v2
txtOperatorName.Text = GridView1.Rows[1].Cells[2].Text.ToString();


If solve please accept. thank you
 
Share this answer
 
Comments
Kaito Nguyen 21-Dec-14 22:56pm    
Thanks for your answer but it don't work...
Member 10889447 21-Dec-14 22:58pm    
why?
what is error?
Check value array of gridview if problem with indeks array.
Kaito Nguyen 21-Dec-14 23:23pm    
It still display "L& #234; Th& #225;nh Ti& #234;n". I don't get any problem with index of array...
Member 10889447 21-Dec-14 23:38pm    
try to debug and please you check the value of it. and quickwatch to see value of index. thanks

i agree with syed shanu
Kaito Nguyen 21-Dec-14 23:40pm    
I declared a string var and used a break point to debug. The result I get as same as the text displayed in textbox.

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