0

I am using a JavaScript to add some content from a ComboBox to RadEditor using a button. It is working fine with HTML button. But, I need to Add another comobox and it should also do the same job, but it need to be hidden some times (Second Combobox is Not Visible All the time)..

<input type="button" onclick="pasteTextInEditor('<%=cmbOne.ClientID%>')" value="Add This Feild" class="button"/>
                                  <script type="text/javascript">
                                      function pasteTextInEditor(clientId) {

                                          var combo = $find(clientId);

                                          var editor = $find("<%=editorX.ClientID%>");
                                          editor.pasteHtml(combo.get_selectedItem().get_value());
                                      }
                                 </script>

Above Code is used to put contents from Combo to Rad Editor...

1 Answer 1

1

I am pretty sure, you can execute this function on client side with OnClientClick event provided from asp button.

Example:

OnClientClick="function (button,args){alertText('Alerted Text','Alerted Title');}
Sign up to request clarification or add additional context in comments.

4 Comments

It Works.. Thankx. Is there anyway to stop post back? - @Rafał Czabaj
If you want to stop Postback from asp:button just set property AutoPostBack="false" in the button properties in the aspx file.
It Didin't Work <asp:Button ID="btnAdd" runat="server" CssClass="button" Text="Button" AutoPostBack="false" />
Okay, at the end of your javascript function in the OnClientClick event add return false; that should prevent the postback according to: [link]stackoverflow.com/questions/683746/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.