I want to export Telerik RadRichTextBox to a variable.
(new RtfFormatProvider()).Export(RadRichTextBox1.Document)
But this code will show this error:
Cannot convert from RadDocument to RadFlowDocument
You probably don't reference the appropriate RtfFormatProvider class.
Check your usings, or explitly call:
(new Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider()).Export(RadRichTextBox1.Document)
Related
I have a custom control with a collection-type field.
When i run the app in debug mode and try to add items to the field, the XAML editor show the error:
Error XHR0015 Failed to add HelloItem to ObservableCollection`1.
Unable to find element.
Why the error? How to solve the problem?
The source code: https://github.com/jhonToni/CustomComponentApp
You couldn't add a new HelloItem in XAML editor in runtime. After you add a new HelloItem, you need to recompile it.
In the Lemoon admin I simply am creating a new Content Type called 'test' with just a simple text box titled 'positionTitle' to start with for testing. It gets created just fine, however once I create a new 'test' object in the site i run into problems. I give it a title, some body text, and the postionTitle as it asks - save it and all is well. However no matter what I change or try I keep receiving this error regarding Content.Title. http://d.pr/i/KVdb
I am using the default 'PageTemplate' as the template for the page so its requesting the Title obviously, however I have it filled out?!
Where am I going wrong, what am I missing? I have poured through the Lemoon docs with no luck.
Thanks in advance.
The PageTemplate is strongly typed to the Page content type as you see in the code-behind of the template. Since you are passing in a Test content type the Content property in the template will be null.
Normally when you create a new content type you will also need to create a new template for rendering it. So what you need to do is create a template for your Test content type. See http://www.lemoon.com/developers/programming/aspnet/templates.
How can I update a textbox or label (specfically an asp.net control) text property from the code in the silverlight control?
Suggested solution:
I suppose that you could try to do it in two steps:
write a javascript function that updates a control based on a given parameter, let's name it updateControl:
<script type="text/javascript">
function updateControl(newValue)
{
//update your control here with newValue parameter with javascript
...
}
</script>
in your Silverlight application (in the place you want to invoke the control value change) you should write:
HtmlPage.Window.Invoke("updateControl", "this is a new value")
Another solution for page update only:
If you just need to refresh the page to get the value from other place, you can write in your Silverlight code:
HtmlPage.Document.Submit()
In the postback, you could get this data and show it in the control.
References and useful resources:
ScriptObject.Invoke Method : http://msdn.microsoft.com/en-us/library/system.windows.browser.scriptobject.invoke%28v=vs.95%29.aspx
Walkthrough: Calling JavaScript from Managed Code: http://msdn.microsoft.com/en-us/library/cc221359%28v=vs.95%29.aspx
Silverlight and JavaScript interop basics: http://pietschsoft.com/post/2008/06/Silverlight-and-JavaScript-Interop-Basics.aspx
How to set the value of a form element using Javascript: http://www.javascript-coder.com/javascript-form/javascript-form-value.phtml
You can do it calling javascript function from silverligt.
Shortly it looks like this:
HtmlPage.Window.Invoke("globalJSMethod", stringParam);
Note that javascript method must be accessable from window - window.globalJSMethod(...)
Check this walkthrough to see in details how to do this.
I want to use a WebBrowser-Control within a WebForm-App. It should load a local Webpage which includes several JS and Images. Is it possible to replace placeholderstrings within the JS before the page gets loaded?
So something like that: get HTML->replace strings via string.replace(..,..)->load the new HTML into the control.
Thanks a lot!
I have a page called test.aspx with test.cs.
However, i want to access my control called mbResult
Which is my custom messagebox control, from a sepearate CS page.
I know many people have asked this question and i have found that this is a method to access my controls.
MessageBoxControl mbox1 = this.FindControl("mbResult") as MessageBoxControl;
But I keep getting this error
Error 5 Keyword 'this' is not valid in a static property, static method, or static field initializer
Any ideas on how to access this control all i am trying to do is make it visible.
Thanks
You need to move the code into a non-shared method. You need to be operating in an instance of the page.
Update for clarification in comments
Unfortunately, your application is going to need some restructuring.
If the messageboxcontrol is shown in a new window, then you will need to pass the value from your source page to the new window in the query string.
However, if you want the messagebox control to be displayed on the source page, then you will need to convert it from a page to a UserControl, add a reference to the user control to your source page, and then add an instance of the usercontrol directly to the source page.
Statics don't have instance-based contexts, so using this is not applicable. You'll need a reference to the control for which you want to use .FindControl (possibly by passing it as a parameter).