Gridview control removing consecutive spaces in column output

 Hi, i am using a simple GridView to retrieve data from a SQL view, and if there are consecutive spaces in the string in a particular column, something (asp?) is removing the 2nd space, and then the output has only 1 space, which is incorrect for this string.

 Interestingly, if I retrieve the same column with a specific select statement in a code behind file, and then output it via either response.write, or in a text box, it does the same thing.   I have debugged while doing this and in the Autos window, the string is correct (with two consecutive spaces), then when it is output to the aspx page, it has only 1 space.

example in SQL column:  ECPATE  0960133L2200100763LAXMI33690849007723 does this to it:     ECPATE 0960133L2200100763LAXMI33690849007723

Notice there is only 1 space after "ECPATE"  where there are two in SQL Server.

Any help would be greatly appreciated. Thanks.

4/17/2008 2:48:31 PM 72751 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 9

It is not grid view which is removing consecutive spaces, it is the browser. Browsers are designed like that to save more space, so it displays only first empty space. To fix this problem use either use pre tag like this <pre>your string     with space </pre> Or replace blank space with &nbsp; symbol

[Don't forget to click on Mark as answer on the post that helped you ]
4/17/2008 5:48:54 PM

Thanks, that makes sense.  However, where would I put the <pre> tag in the .aspx file when using a gridview?    I tried putting it before the <asp:Gridview ID=  section - which certainly changed the formatting, but did not resolve the spacing issue within the returned column value.   Visual Studio gives an error if you try to put <pre> anywhere in the <Columns> section, or immediately before and afterwards..  and I cannot insert the &nbsp symbol in the middle of a returned column value, or at least I don't know how.

4/17/2008 6:29:54 PM

Oh for that you need to create a template field

                        <pre><%# Eval("myColumn")%></pre>

[Don't forget to click on Mark as answer on the post that helped you ]
4/17/2008 7:00:42 PM

Similar Artilces:

remove a gridview column dynamically, removes controls in template columns
I have a interface with a treeview and a gridview. The gridview has two templatefields that handles insert/update/deletes. The gridview is handling editing of different tables so I create the other columns in the gridview dynamically as boundfields. The user selects the table to edit in the treeview. The problem I am having happens when the user selects a table to edit the second time. The code that executes removes all bound fields, (dynamically added when user selected the first table in the treeview), but not the two template fields, and then adds boundfields specifi...

How can I control the width of a column in the GridView control.
From searching I see mention of ways to do it before the controls are bound. Is there a simpler way? If not, could someone explain to me how I need to go about it?Here is the code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"        DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."        OnSelectedIndexChanged="GridView1_SelectedIndexChanged">   &nbs...

gridview control in another gridview control
Hi ia have a questioni have a gridview control which contains button in one my question is i need another gridview to be placed in the  first gidviewso that when i click on the button the second gridview will populate the my question is how to place second gridview in first gridview.or is there any approach like first grid itself acting as parent and child.please help me  Hi sirikalavalapalli:                I think nested gridview will help you. Check this link and it will show you how...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,,MC...

Gridview control embedded in another gridview control
I am writing an ambulance crew scheduling application on the web and I need some help completing the last part.  I have an access database that has three tables: user table, shift table (describing the shifts available), and a schedule table (that stores shift by shift_id and user by user_id).  I have a gridview control that will display the available shifts but I cannot get the embedded gridview control that will display the user that is signed up for each shift to display because I cannot figure out how to use the OnRowDataBound method.  I need a simple VB example of how to...

Help Req: !!! :- On Disabling Controls Present inside a Gridview control
Hi All, We have A requirement Where we have disable controls inside a grid.These controls can be textbox, DropDownlist (in TemplateField), ComandField present inside the grid.We have to call a generic method for doing the same .(since it can be done for multiple grid.) PFB the code snippet we use. Which disables all the controls inside the page.The bolded part of the code is used to loop inside a grid view.(Not Working.)Is this ideal way to deal with the requirement.Or can someone suggest be a better way.        public void DisableMe(Page p1, st...

i have work on gridview that i have as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i
hi,i have work on gridview that i have as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i want display half of the data and remaining display like this.(ex: can i display like this,and one more thing is always the column size will constant. Try something like this: <asp:templatefield headertext="Link"> <itemtemplate> <asp:hyperlink id="HyperLink1" runat="server" navigateurl='<...

There is a Gridview Control in the tmplate field of another GridView Control.
    For instance,a gridview displays the information of the  students in a class.A table is recording the information except their mark.There is another table recording the mark of the students whose foreign key is the primary key of the previous table.   string strSQLconnection=".................."; SqlConnection sqlCononection=new SqlConnection(strSQLconnection); SqlCommand sqlCommand=new SqlCommand("select * from stuendent where classID=1",sqlConnection); SqlConnection.Open(); SqlDataReader reader=sqlCommand.ExecuteReader(); GridVie...

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...

validation controls in gridview control
hi, I m using the grid view to add,edit,update,delete the data table. Everything is fine.In the footertemplate i get the values through text boxes and drop down lists.i took place sm validation controls to validate these controls.the problem arises here.if i want to update the record after i click the edit button, it validate the page n dont allow me to update the record.I want to validate the particular controls only. i checked if any causes validation property for update button.there is nothing like that. pls help me.. thanks in advance gowri  regards,gowripillaimark as answer if...

SqlDataSource Control and Gridview control
Hi, I'm new to web development and learning about these controls.  The books teach you to bind the gridview control to an sqldatasource to perform delete,update,insert functions as well as to list the records in a table.  Is this standard practice for real world applications?  Or is there another way that should be used to display/manage table data in the gridview control? Thanks. Tulsi Using a sqldatasource is the best way I know of for binding data to a gridview.  (I'm pretty new to web development too, so maybe someone else can chime in if they know someth...

using controlS to control a gridview
This question is probably posted but i did not bother to look at 10,000+ posts so i am sorry. I've seen the tutorial where he builds a dataset and uses a gridview and controls the gridview with the drop down list box. What i am trying to do is to control the gridview with 2 drop down list boxes. First select the Country you life in and then the State. I've looked at the grid view properties but couldn't find where i can add another parameter. Is it possible to control a grid view (or any form of displaying the information) with more than 1 controller? Thank You.  ...

Precise Control over GridView controls?
Hi.When you create a GridView in visual studios and bind it to, say, an SqlDataSource, it automatically creates fields and templates according to the types retrieved from the data source. (ie, it creates a Label for number/string columns, checkboxField for booleans, etc). My question: How do I control precisely what WebControls/Fields are used for each column?thanks,Tombow Hi Tombow Using TemplateFields you can control that explicitly.  See the Data Tutorial #12 at for more details. Hope that helps. AaronDon't...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

Web resources about - Gridview control removing consecutive spaces in column output -

List of most consecutive starts by a National Football League quarterback - Wikipedia, the free encyclopedia ...
On December 5, 2010 against the Buffalo Bills, Favre was knocked out of the game on the first drive with a sprained SC joint injury to his right ...

2014 Nathan's Hot Dog Eating Contest - Joey Chestnut Wins 8th Consecutive Title! - YouTube
Joey "Jaws" Chestnut holds off tremendous challenge from Matt Stonie on the way to his 8th consecutive title at Nathan's annual hot dog eating ...

Melbourne marks coldest consecutive mornings in 17 years
Melburnians have trembled through their coldest consecutive mornings for 17 years.

Sebastian Vettel wins fourth consecutive world title: Video
Sebastian Vettel secures his fourth Formula One championship title after winning the Indian Grand Prix.

Thirty years of consecutive warmth: the heat really is on
... 30 years in which average monthly temperatures worldwide have been warmer than the average for the 20th century. century. That's 360 consecutive ...

Northern Ireland police face sixth consecutive day of riots in Belfast
LOYALIST protesters have attacked Northern Ireland police with petrol bombs, fireworks, bottles and stones during the sixth consecutive night ...

‘Air Bud’ Wins Best Picture for 18th Consecutive Year
Viewers of the 87th Academy Awards today were unsurprised to learn that the 1997 family comedy Air Bud took away its 18th consecutive Best Picture ...

Watch Steph Curry hit 43 consecutive three-point shots
To most Australians, Andrew Bogut is the most recognisable player in the NBA team, the Golden State Warriors. But the San Francisco-based side ...

Australian Stacey Keating wins second consecutive title
Australian Keating wins second consecutive title

Ash cloud leaves Bali holidaymakers stranded for third consecutive day
Wind-borne volcanic ash from Mount&nbsp;Raung is&nbsp;disrupting flights.&nbsp; Bali holidaymakers have been thwarted for the third consecutive ...

Resources last updated: 11/26/2015 6:08:27 AM