Solved

Converting data grid template control to DataBoundLiteralControl

Posted on 2006-11-30
2
306 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now