How can I keep the same format for data coming from database.

I am using VWD Express edition.

After searching a database I am displaying the result
in a DetailView form. I am having problem with the text
format. The information coming from the database does not
keep the same format as the one typed on the user interface.
I know why and I have been working on this for a while now, but
can not solve the problem yet.

When I right click the upper right corner icon of the DetailView
in the Design mode page, and then click edit field, a window comes up.
In this window I click the selected field and on the right, the bound field
property window comes up. We can find the following here: Under behavior, we can find, HtmlEncode and HtmlEncodeFormatString. And under Data, we can
find DataFormatString.

I would like to know if by entering any information here I
can keep the same format of the text entered to the database
for display in the DetailView and how is this done.


5/4/2009 8:57:27 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 4
Get it on Google Play
Get it on Apple App Store

The information coming from the database does not keep the same format as the one typed on the user interface.

You mean like when someone uses the Enter key to put spaces between paragraphs or sentences?  If this is the case you will have to convert the Enter key characters to <br/> tags at some point.  You might also look into using a WYSIWYG editor for your text (it will allow users to enter in HTML) in the user interface.

The Enter key characters in VB.NET are defined as with the vbCrLf constant so just do a Replace on that.

- William

Please mark the most helpful reply/replies as "Answer".

Give some of my PWSK modules a try.
5/4/2009 11:37:02 PM

I did everything that you said long ago and is not working. This is an example of what I did, do you see any problem?

Dim CommentTextBoxToFixFormat As String = DirectCast(FormViewDataEntry.Row.FindControl("CommentTextBox"), TextBox).Text.ToString

CommentTextBoxToFixFormat = CommentTextBoxToFixFormat.Replace("\n", " &lt; br /&gt; ")

DirectCast(FormViewDataEntry.Row.FindControl("CommentTextBox"), TextBox).Text = CommentTextBoxToFixFormat

But when I use the following code:  

CommentTextBoxToFixFormat = CommentTextBoxToFixFormat.Replace("a", "b")

in order to change all "a" for all "b" to see if the code works, it does work, but not with \n an br />, what is the problem?



5/5/2009 12:24:59 AM

Similar Artilces:

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

How I can populate Treeview control data coming from database
Hello, I need some help on how to populate treeview control.  Data is coming from database, and after query, the result something like this: SQL Results: AppName     AccName      Region       District      Facility App1           Acct1             1             1         &n...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

Bind Data to an Image Control not in a Data Presentation Control
I've been searching for two days but I don't really know what to search for.I'm making a site for a photographer.  The Default.aspx page displays Albums by showing a title, image and description from the database table Albums. Click an album to view the contents and it passes the QueryString which is AlbumName.  The ViewAlbum.aspx page uses the QueryString to display an UpdatePanel holding a Large Image and a Repeater full of dynamically filled ImageButtons for thumbs.  Both are from the database table Photos and are retrieved using an ObjectDataSource. Click the ...

After a user has entered his registration info I want to add him to my database. Is there a specific control which can handle the update/insert of data from a form into a database?
After a user has entered his registration info I want to add him to my database and also validate whether his name/e-mail is already registered. Is there a specific control which can handle the update/insert of data from a form into a database?If not, how can I add someone? Basically what im asking is how can I add a new user using the best method (best functionality) of the .NET framework. So validate duplicates AND add this user. ;)please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already. Hi, you could use this sample as a...

login control can i used to controll what data can user see it
i have a project with mulit company can i used login control to control what company user can see it and what user cant see it the company comes from databasethanks alot for any help first of all you should have a table in database database that contains (user_id, company_id,  password, auth_level). the auth_level can be used to grant specific content/page access to each user of each company. but, you need to override the authentication process as bellow.    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { L...

Y ADO.NET does not return a simple ReadOnly Query data as a DataTable though we need most of the times a Single Table of Data from DataBase ? Similar to DataAdapter returning a DataSet ! Or can we Typ
Hi All, After we moved from JSP and started developing a web application in ASP.NET, the DataAdapter is used for all sort of operations like insert/update/delete for a table. But, most of the time we need to query the data from db for a Table/View and the returned data will be a Single Table of data. Though ADO.NET has a facility of keeping such a data in DataTable, y does ADO.NET have not provided a way to return a DataTable. Similar to DataAdapter returning a DataSet. Its like a mix up of DataReader and DataAdapter with Read Only component returning DataTable. Or, please let me know...

populating the listbox control with the data coming from the database.
 Hi,im trying to calling a webmethod which inturn calls a server method which fills list box with the data coming from the database. but everything is going fine instead my list box is not filling up with the records coming from the database.Below is my code: <% @ Page Language="VB" AutoEventWireup="false" CodeFile="AdvancedSearch.aspx.vb" Inherits="AdvancedSearch" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><script runat="se...

How can I send data to database in a client side control?
I am using a normal HTML button < button onclick="Confirm()" >   to control a popup window. I use the button to send the data from the form to database and close the popup window. The javascript function Confirm() does the close window action. The question is, because I am not using a server side control like , how can I send the data, on the popup window to the server to store in database? Do I need to use Ajax? Thank you.  You will need to use Ajax.Net to return the data.Don't forget to click "Mark as Answer" on the post that helped you....

How come I can connect to a database through a datasource control, but not code?
Hi I am trying to open a database connection to a Northwind database.  I can open it with a datasource control and return data to a gridview, but can't programically.  I get a sqlexception error.  this is ust for learning. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim S As New SqlConnection        Dim builder As New SqlConnectionStringBuilder        builder("Data Source") = ".\SQLEXPRESS;AttachDbFilename=...

How do the different data presentation controls equate in
How does Visual Studio create equivalents of the datagrid's and gridview's columns and rows?  I am assuming they make a DataRow for each of the rows.  Am I on the right track with this?Is the table created by gridview basically a dataset from  Can anyone offer any guidance with this?Thanks to everyone that has ever helped me with any posts. Hi newbie2C#, The row in datagrid is called DataGridItem and in gridview is called GridViewRow. They are all inherits TableRow Class. DataRow is only one kind of row in GridView control. There are many other t...

Data presentation without a data control
The Gridview and Formview controls provide good functionality in some circumstances but are clumsey in others. As a newbie to .NET I was wondering if its appropriate to do databinding with textboxes and other data controls outside of one of the new data controls (formview, gridview, etc). Or is it a new standard to always use one of the new data controls. If the answer is yes, would you still use an SQLDatasource, or would you set up the connection in code? And, how would you deal with the syntax? In the Formview we have: <asp:TextBox ID="fnameTextBox" runat="server" ...

Insert data from a dropdownlist and textbox control into a database (
Hi everyone, I am creating an application for my students.  I teach piano.  There are three levels for them: Beginner, Intermediate, Advanced. After they have logged in, they are given the opportunity to select various pieces of sheet music to learn according to their level from a dropdown list control.  I have created the database which lists the sheet music and bound it to the dropdownlist control.  I have also added a textbox control where I want them to type in the reason why they selected the particular piece of music to learn (I know, kids hate writing essays, but ...

ajax control in data presentation controls
can i add ajax controls (MaskedEdit) to presentation controls (dataGrid, dataForm)?? Hi,of course. But keep in mind that those controls are extenders, so you append them to an existing control. Just convert your GridView / DetailsView-fields into templated fields and add the extender you'd like to use to the controls.RegardsMarco Buerckel Don't forget to mark posts that were helpful as answers. Actually, if you looked at the source code for the Masked Edit Extender, you'd see  [TargetControlType(typeof(TextBox))]Meaning, targeting any control type other than textboxes...

Web resources about - How can I keep the same format for data coming from database. -

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

ERISA and All Claim databases
... laws, on the books in 18 states, requiring self-insured employers to report data about the prices they pay to “all payer claims databases.” ...

Sanders’ campaign looses access to N.H. Democratic voter database - The Boston Globe Sanders’ campaign ...
... the presidential campaign of US Senator Bernie Sanders has been denied access to the New Hampshire Democratic Party’s valuable voter database ...

Under pressure, DNC restores Bernie Sanders campaign's access to their database - Videos - CBS News
A strange twist in the race for the democratic presidential nomination: the campaign of Vermont Senator Bernie Sanders has filed a complaint ...

Over 680TB of data exposed in MongoDB databases
There are at least 35,000 publicly accessible and insecure MongoDB databases on the Internet, and their number appears to be growing. Combined ...

Database error publishes data of 3 million Hello Kitty fans
Online researcher Chris Vickery uncovered a database this weekend containing the personal information of 3.3 million accounts associated with ...

MacKeeper Leak Highlights Danger of Misconfigured Databases
The Shodan port-scanning service finds at least 35,000 MongoDB databases accessible without a password.

OracleVoice: Oracle Challenges SAP On In-Memory Database Claims
Companies that run SAP’s applications should know that most of those applications can perform much better on Oracle Database than on any other ...

Resources last updated: 12/24/2015 6:49:40 AM