ASP datagrid ignoring whitespace?

Results 1 to 2 of 2

Thread: ASP datagrid ignoring whitespace?

  1. #1
    Join Date
    Dec 1969

    Default ASP datagrid ignoring whitespace?

    Hi there - I&#039;m actually writing the business layer of an n tier .net app. This particular problem stems from my attempts to build certain data in the dataset that is being passed back to the asp front end and is being mapped into a datagrid for web display. All grids so far display fine...until that is, I attempt to insert whitespace. As with most web page grids, the grid accepts a single space (in between words for example) - but seems to automatically remove any other spaces. <BR><BR>snapshot of code that builds my record:<BR><BR>Business layer code that modifies the dataset....<BR>=================================== ==============<BR><BR>foreach(System.Data.DataRow drOneRow in ds.Tables[0].Rows) <BR> { <BR> if ((int)drOneRow[1] &#062; 0 )<BR> { <BR> delimiter = "¦"; <BR> for (int i = 0; i &#060; (int)drOneRow[1]; i++)<BR> { <BR> if (i+1 == (int)drOneRow[1])<BR> {<BR> delimiter = delimiter + "------&#062; ";<BR> }<BR> else<BR> {<BR> delimiter = delimiter + " ------";<BR>etc..etc<BR><BR>ASP front end code that loads the grid<BR>======================================<BR> Try<BR> &#039;## DIMS FOR BUSINESS LAYER INFORMATION<BR> B_Category = New BSLayer.Category(context.User.Identity.Name(), "")<BR> &#039;## GET DATA FROM BUSINESS LAYER<BR> ret = B_Category.ListCategory(B_Category_Dataset)<BR> &#039;##<BR><BR> For i = 0 To B_Category_Dataset.Tables(0).Columns.Count - 1<BR> &#039;define col<BR> col = New BoundColumn()<BR> col.DataField = B_Category_Dataset.Tables(0).Columns(i).ColumnName <BR> col.HeaderText = B_Category_Dataset.Tables(0).Columns(i).ColumnName <BR><BR> &#039;hide or show it<BR> If i = 0 Then<BR> col.Visible = False<BR> Else<BR> col.Visible = True<BR> End If<BR><BR> &#039;set formatting<BR> col.ItemStyle.HorizontalAlign = HorizontalAlign.Center<BR> col.HeaderStyle.ForeColor = System.Drawing.Color.White<BR> col.HeaderStyle.Font.Underline = False<BR> col.HeaderStyle.Font.Bold = True<BR><BR> &#039;add it<BR> Me.DataGrid1.Columns.AddAt(i, col)<BR> Next<BR><BR> Me.DataGrid1.DataSource = B_Category_Dataset<BR>Catch ex As Exception<BR> ErrorHandle.ErrorEvent (ex)<BR><BR>...<BR>etc<BR>etc<BR><BR>No matter what I try - the datagrid seems to remove spaces (even when I use .net standard ctrl characters like the tab &#039; &#039;.<BR><BR>Has anyone managed to get any spaces (more than one) in a cell<BR>within a datagrid ... if so - could you let me know how?<BR><BR>Many thanks<BR><BR>Chris.

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP datagrid ignoring whitespace?

    Remember that the results of the datagrid are standard HTML, and HTML ignores things like tabs ( ) and multiple spaces. When trying to put in multiple spaces use the HTML space character: &#039;ampersand&#039;nbsp&#039;semicolorn&#039;<BR ><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts