Solved

Converting data grid template control to DataBoundLiteralControl

Posted on 2006-11-30
2
311 Views
Last Modified: 2012-05-05
I'm trying to access the text in a data grid template control which I'm able to do however the results that are returned have 25 characters around it.  The characters are not spaces as the trim function does not remove them.  My code is:
Public Sub dgProgramManager_Edit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgProgramManager.EditCommand
        Dim temp As String = CType(e.Item.Cells(3).Controls(0), DataBoundLiteralControl).Text
        Dim temp2 As String = Len(temp)
        dgProgramManager.EditItemIndex = e.Item.ItemIndex
End Sub

When I debug it the temp variable has the following content:
"             name           "
and the length is 29

The result should be just "name".

Any suggestions would be greatly appreciate.

Les
0
Comment
Question by:leskelly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
kraffay earned 250 total points
ID: 18049050
I think they are encoded spaces that .NET puts in the literal in order to center it.  Try to determine the ASCII code of characters with ASC function, and see if you can strip that out.
0
 

Author Comment

by:leskelly
ID: 18094422
For anyone else who enconunter this the ASCII codes are 13, 10 and 9.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question