
Greetings,
Sorry about the question title. It should read:
"Using 'pasteHtml' to capture the value of an external input button"
I found the following code here on site with the associated title:
The following example will show you how to paste content into the editor's content area from an external input button:
-----------------------------------------------------------------------------------------------------------------------------
<telerik:radeditor runat="server" ID="RadEditor1"></telerik:radeditor>
<input type="button" value="Paste Content" onclick="InsertSpan();return false;" />
<script type="text/javascript">
function InsertSpan()
{
var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to the editor
editor.pasteHtml('<span style="width:100px;border: 1px solid red;background-color: blue;color: white;">sample content</span>');
}
</script>
-----------------------------------------------------------------------------------------------------------------------------
Can anybody explain to me how this does _anything_ with a value outside the RadEditor. Seems to me there is a very necessary piece left out of the example. For instance, when using 'OnClientCommandExecuting(editor, args)' to do this kind of thing 'within' the editor, the args parameter is used to produce the value of 'val':
var val = args.get_value();
editor.pasteHtml("<div style='width:100px;background-color:#fafafa;border:1px dashed #aaaaaa;'>" + val + "</div>");
As we can see, the code provided for the external input doesn't come close to addressing how to handle the outside value.
Am I missing something here??
Thanks!

| Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated |
| Dim CB_Groupe As RadComboBox = TryCast(e.Container.FindControl("CB_Groupe"), RadComboBox) |
| Dim CB_Forfait As RadComboBox = TryCast(e.Container.FindControl("CB_Forfait"), RadComboBox) |
| CB_Forfait.Items.Add(New Telerik.Web.UI.RadComboBoxItem(CB_Groupe.SelectedValue)) |
| CB_Groupe.AutoPostBack = True |
| AddHandler CB_Groupe.SelectedIndexChanged, AddressOf CB_Groupe_SelectedIndexChanged |
| End Sub |
| Protected Sub CB_Groupe_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) |
| Lbl_titre.Text = "j'ai changé" |
| End Sub |
If
Me.RadComboBox1.Attributes.Item("TreeviewSelectedItem") Is Nothing Then
If objuser.DivisionTwo <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.DivisionTwoDesc)
ElseIf objuser.DivisionOne <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.DivisionOneDesc)
ElseIf objuser.PearsonBusiness <> 0 Then
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", objuser.PearsonBusinessDesc)
Else
Me.RadComboBox1.Attributes.Add("TreeviewSelectedItem", "Please select a division")
End If
End If
this works and does preload the correct demographic in the combobox, but problem is when you press 'save' again and havent changed the combo box when it goes to save the demos if have this code to get the chosen id
Dim NewRadTreeDivisions As Telerik.Web.UI.RadTreeView
Dim DivisionValue As Integer
NewRadTreeDivisions = RadComboBox1.Items(0).FindControl(
"RadTreeView1")
If NewRadTreeDivisions.SelectedValue = "" Then
DivisionValue = 0
Else
DivisionValue = NewRadTreeDivisions.SelectedValue
End If
but now at this point NewRadTreeDivisions.SelectedValue does equal "" therefore sets it back to 0. even though the correct text is shown in the box the value isnt being passed through...how can i get this to keep the id???
thank you!
| protected void lbxAssigned_Transferred(object sender, RadListBoxTransferredEventArgs e) |
| { |
| foreach (RadListBoxItem listItem in lbxAvailable.Items) |
| { |
| if (listItem.Selected) |
| { |
| ProductCarriers objPC = new ProductCarriers(); |
| string test = listItem.Text; |
| objPC.Allocate(Convert.ToInt32(listItem.Value), Convert.ToInt32(cbxProducts.SelectedValue)); |
| } |
| } |
| PopulateLists(); |
| } |