» nvarchar field has wrong encoding when loaded from SQL sevrer
nvarchar field has wrong encoding when loaded from SQL sevrer
|July 29, 2014
Posted by forumadmin
I have table with column
MasName of type
nvarchar(100). I am using SQL Server 2012 and Entity Framework 6 to work with database. I have DetailsView where I always bind one relevant record:
<asp:DetailsView ID="masDetailView" runat="server" AutoGenerateRows="False"
SelectMethod="GetMas" UpdateMethod="UpdateMas" ItemType="NSMAS.DAL.Mas"
<asp:Label runat="server" ID="nameLbl" Text='<%#: Item.MasName %>'></asp:Label>
<asp:TextBox ID="nameEdit" runat="server" Text='<%#: Item.MasName %>'></asp:TextBox>
Text binded to Label
nameLbl show correctly:
Hříběcí hory, but when I click auto generated edit button and text is binded to
nameEdit (for editing entry), text is:
Where could be problem? Can I fix this for all records or do I have to set encoding to every TextBox (that I don’t know how since I don’t bind text in codebehind)
So I have rewrited
Text='<%#: Item.MasName %>' to
Text='<%# Item.MasName %>' and now it works. I was told that it’s better to use
<%# when I access data like this, but I can’t find any article about what is this exactly doing.
More Related Questions
- Internal Connection fatal error while reading from a SqlDataReader I have an ASP.NET application written in C# and using SQL Server 2012 as backend.
I am getting a Internal Connection fatal error while reading from the SqlDataReader.
This is my code […]
- Provision File Table of SQL Server in Entity Framework I have a project where I need to create a FileTable in SQL Server. How can I provision that using EF? Asked By - Ramon Cruz Read Answers
- purpose of EF 6.x DbContext Generator I have a web app that I built using Linq-to-SQL and I'm looking to upgrade it to Linq-to-EF. I've looked at some tutorials and basically in the database-first scenario, you create an […]
- update-database command in EF6 not working after initial migration I got stuck at command:
while going through this tutorial by Tom Dysktra
Here is the error I am getting:
Specify the '-Verbose' flag to view […]
- How can I prevent an Entity Framework objects properties from being altered in a default edit action? This is the default edit/update action generated by MVC 4:
// POST: /User/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
- Serialize genereted classes from ADO.NET entity model I have the following table:
create table Movie
id integer primary key identity(1,1),
- SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry I have a strange scenario in which the auto identity int column in my SQL Server 2012 database is not incrementing properly.
Say I have a table which uses an int auto identity as a […]
- Entity Framework 6 and MySQL, model first I have a problem using Entity Framework 6 with MySQL and doing so using model/database-first technique in ASP.NET C# MVC 3.
The current situation is that I’m getting the error:
- Is this a safe and *relatively okay* way to log certain events asynchronously? Working with:
Entity Framework 6 (Context Per Request)
IIS 8, Windows 2012 Datacenter
Main concern: Thread safety and reliability.
The project consist of a […]
- Azure Entity Framework connection string failing Everything works great when I run my project locally, but when I deploy to Azure I get the following error.
"Code generated using the T4 templates for Database First and Model First […]