page 1 of 1
Comments: 1 | Views: 538

Hi all

I have javascript function that insert text into freetextbox at current cursor position. It works well when I call this function onClientClick event passing a string as a parameter (This string is inserted into freetextbox at current cursor position). My code is as follow

 

<

FontForeColorPicker,FontBackColorsMenu,  runat="Server" DesignModeCss="designmode.css" EnableSsl="True" Focus="True"/>  <asp:Button ID="btnInsert" Text="Insert Text" CssClass="button" runat="server" OnClientClick="insertValue('abc');" />

 

 

<

script language="javascript" type="text/javascript"> </script>

 

 

 

<FTB:FreeTextBox id="FreeTextBox1" toolbarlayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,

FontForeColorPicker,FontBackColorsMenu,  runat="Server" DesignModeCss="designmode.css" EnableSsl="True" Focus="True"/>  <asp:Button ID="btnInsert" Text="Insert Text" CssClass="button" runat="server" />

 

 

 

<

 

 function insertValue(field) {

FTB_API['<%=FreeTextBox1.ClientID%>'].Focus();

FTB_API['<%=FreeTextBox1.ClientID%>'].InsertHtml(field);

FTB_API['<%=FreeTextBox1.ClientID%>'].Focus();

window.event.returnValue =false;

 

}

 

I am also using AJAX Scriptmanager on my webpage.

 

script language="javascript" type="text/javascript"> </script>

 function insertValue(field) {

FTB_API['<%=FreeTextBox1.ClientID%>'].Focus();

FTB_API['<%=FreeTextBox1.ClientID%>'].InsertHtml(field);

FTB_API['<%=FreeTextBox1.ClientID%>'].Focus();

window.event.returnValue =false;

}

 

The above code is working fine and insert string 'abc' into freetextbox's cursor position

But I want to insert string from code behind file in C#.Net (Server side text)

For this purpose I removed the OnclientClick from btnInsert and passed called this javascript function on page load but it does not work

The New code is given below

//Code Behind

 

protected void Page_Load(object sender, EventArgs e)

 

 

 

{

 

 

string str = "Abc";

btnInsert.Attributes.Add(

}

//HTML Code It is same as above except OnClientClick="insertValue('abc') has been removed.

"OnClick", "insertValue('" + str + "')");

FTB:FreeTextBox id="FreeTextBox1" toolbarlayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu,
Harlequin
Harlequin
http://twitter.c​om/TrueHarlequin

http://freetextbox.com/forums/19/ShowForum.aspx

You should probably ask on the FreeTextBox forums, they'd be more help with their own product.

page 1 of 1
Comments: 1 | Views: 538
Microsoft Communities