Как отобразить количество слов при подаче текста только в ckeditor
I need to display the word count while giving the text in ck editor only but with my above code i am able to get the word count on button click.How to display the word count directly while giving text in ck editor instead of button click
<div> <ckeditor:ckeditorcontrol id="CKEditor1" basepath="/ckeditor/" runat="server"></ckeditor:ckeditorcontrol> <asp:button id="btn1" runat="server" onclick="btn1_Click" text="get word count" /> <asp:label id="lbl1" runat="server"></asp:label> </div>
protected void Page_Load(object sender, EventArgs e) { } protected void btn1_Click(object sender, EventArgs e) { string whole_text = CKEditor1.Text; string trimmed_text = whole_text.Trim(); // new line split here string[] lines = trimmed_text.Split(Environment.NewLine.ToCharArray()); // don't need this here now... //string[] split_text = trimmed_text.Split(' '); int space_count = 0; string new_text = ""; foreach (string line in lines) { // Modify the inner foreach to do the split on ' ' here // instead of split_text foreach (string av in line.Split(' ')) { if (av == "") { space_count++; } else { new_text = new_text + av + ","; } } } new_text = new_text.TrimEnd(','); // use lines here instead of split_text lines = new_text.Split(','); //MessageBox.Show(lines.Length.ToString()); lbl1.Text = lines.Length.ToString(); }
Что я уже пробовал:
my above code gives the word count on button click instead i need to get the word count while typing the text in ckeditor itself.How can i do this