Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox behavior help needed 1

Status
Not open for further replies.

Malchik

Programmer
Dec 8, 2001
148
CA
Hi,
I pull some information from an Access database, the text is in French, so there is accents in the string. If I display the fields content in a datalist directly bound to an AccessDataSource all the strings are fine.

I am constructing a screen that I will use to update my news. When I select a news to edit from a listbox, I load the information in a gridView and populate the appropriate textboxes (only one record is return by the datasource). All the French characters are replace by coding. For example à become à Here is the code I use, I know there is probably a better way to do that, but I just start to learn ASP.Net...

Dim gvNews As New GridView
dbNewsEdit.DataBind()

gvNews.DataSource = dbNewsEdit
gvNews.DataBind()

txtDate.Text = gvNews.Rows(0).Cells(1).Text
txtTitle.Text = gvNews.Rows(0).Cells(2).Text
txtDesc.Text = gvNews.Rows(0).Cells(3).Text
If gvNews.Rows(0).Cells(4).Text = "0" Then
optNo.Checked = True
Else
optYes.Checked = True
End If

gvNews = Nothing

I notice that in debug mode, if I do a SHIFT-F9 on the gvNews.Rows(0).Cells(3).Text, the debugger gives me an option to see the result in TEXT, HTML or XML mode and in HTML all the characters are fine...

Thanks for your help.

Mal'chik [bigglasses]
 
when you pull a value from a gridview you are pulling html. If you pull the value from the datasource then you are pulling the actual data.
using the selected record, access the data record and use that value to populate the textbox. something like this
Code:
DataView view = gvNews.Rows[0].DataItem as DataView;
txtDate.Text = view["Date"].ToString();
txxTitle.Text = view["Title"].ToString();
txtDesc.Text = view["Desc"].ToString();

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top