This is a migrated thread and some comments may be shown as answers.

Can't set SourceURL as String from Code

4 Answers 63 Views
HTMLPlaceHolder
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 16 Jul 2010, 05:44 PM
In the declaritive side of HTMLPlaceHolder I can set the SourceURL as any string and it accepts it. But from code I have to directly supply a system.URI object.

The problem for me is if I want to assign for example "http://telerik.com/page1.aspx?ID=net%2b2009" to the SourceURL. When I construct a system.URI from that string it removes the %2b encoding and replaces it with the unescaped +.

Whether this is correct or not, and whether + should be encoded as part of a querystring becomes immaterial when the source we are trying to load requires it.

It would be much easier if we could assign a string to the SourceURL property.

4 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 19 Jul 2010, 12:05 PM
Hi James,

Thank you for this suggestion - for the moment we will not change the property type. If there are other users complaining about that - we will provide an alternative way of setting this. If you need help with implementing a solution with the current binaries - please let us know.

Kind regards,
Valentin.Stoychev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 19 Jul 2010, 06:42 PM
Help would be great.

We tried today to use binding instead of setting the property directly in code, unfortunately this still leads to the string http://telerik.com/page1.aspx?ID=net%2b2009 being changed to http://telerik.com/page1.aspx?ID=net+2009 which was a very disappointing moment.

It seems the only way we can get the string to retain the escaping we desire is to set it declaratively, which doesn't work for us, because we need to be able to change it on the fly.

As you can see here I can no longer create a URI where I control the escaping:

http://msdn.microsoft.com/en-us/library/9zh9wcb3.aspx

That constructor is now obsolete.

Any other ideas?
0
Accepted
Valentin.Stoychev
Telerik team
answered on 20 Jul 2010, 02:43 PM
Hi James,

You can use this code:

RadHtmlPlaceholder1.HtmlPresenter.Children[0].SetProperty("src", "http://telerik.com/page1.aspx?ID=net%2b2009 ");




Regards,
Valentin.Stoychev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James
Top achievements
Rank 1
answered on 20 Jul 2010, 03:39 PM
Thanks, that works for us. Problem solved.

However it would be a lot easier and less confusing if we could set the string directly...
Tags
HTMLPlaceHolder
Asked by
James
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
James
Top achievements
Rank 1
Share this question
or