Knowledgebase Home Page  >  RapidSpell Web ASP.NET  >  Misc
Search the Knowledge Base
Using 1 RapidSpellWInlineTextBox (as you type) with multiple regular plain text boxes.
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=208&catId=60

Options

Print this page
Email this to a friend

 

If you need to have a lot (hundreds) of textboxes on a form with as-you-type enabled - it may be best to use regular text boxes along with 1 as-you-type enabled inline textbox.  By moving the inline text box over the regular text boxes, we can acheive the same effect as having all inline text boxes, with less browser load.

 

Please try this example or the one below it, and note the addition of onfocus handlers in the regular text boxes, which is the only per textbox addition (trivial for grids and repeaters).

 

 

Example 1

<%@ Page language="c#"  %>

<%@ Register TagPrefix="rapidspellweb" Namespace="Keyoti.RapidSpell" Assembly="Keyoti.RapidSpellWeb.ASP.NETv2" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>NonStatic-AsYouType-RSWI</title>

<script>

function itb_blur(){

inlineTB.custom_shadow.value=inlineTB.GetText();

}

function tb_focus(tb){

rsw_updatePosition(inlineTB._getTBS().iframe, tb);

var w = rsw_getElementWidth(tb.id);

var h = rsw_getElementHeight(tb.id);

if((document.compatMode && document.compatMode!="BackCompat") || navigator.userAgent.indexOf("Gecko")>-1)//correct width when in strict mode

{

w = rsw_adjustOffsetWidthForStrict(inlineTB._getTBS().iframe, w);

h = rsw_adjustOffsetHeightForStrict(inlineTB._getTBS().iframe, h);

}

inlineTB._getTBS().iframe.style.width = w+"px";

inlineTB._getTBS().iframe.style.height = h+"px";

inlineTB._getTBS().iframe.style.backgroundColor = "white";

inlineTB.custom_shadow = tb;

inlineTB.SetText(tb.value);

inlineTB.Focus();

inlineTB._getTBS().spellChecker.OnSpellButtonClicked();

}

var inlineTB;

function RS_OnTextBoxesInitialized(){

inlineTB = <%= RapidSpellWInlineTextBox1.ClientSideObject %>;

inlineTB.OnBlur = itb_blur;

inlineTB.OnCorrection = itb_blur;

}

 

</script>

</head>

<body onload="rsw_autoFocusAfterAJAX=false" >

<form id="Form1" method="post" runat="server">

<asp:TextBox ID="txtCity" runat="server" TabIndex="1" Font-Names="Verdana" Font-Size="10pt"

onFocus="tb_focus(this)" Height="53px" Width="195px" Text="textbox 1" TextMode="MultiLine"/>

<br />

<asp:TextBox ID="TextBox1" runat="server" TabIndex="1" Font-Names="Verdana" Font-Size="10pt"

onFocus="tb_focus(this)" Height="53px" Width="195px" Text="textbox 2" TextMode="MultiLine"/>

<rapidspellweb:rapidspellwinlineTEXTBOX id="RapidSpellWInlineTextBox1" style="Z-INDEX: 101; LEFT: -89px; POSITION: absolute; TOP: -107px"

runat="server" ForeColor="Black" Font-Size="10pt" Font-Names="Verdana" Height="1px" Width="1px" TextMode="MultiLine"

></rapidspellweb:rapidspellwinlineTEXTBOX><asp:hyperlink id="HyperLink2" style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 491px"

runat="server" Font-Names="Arial" NavigateUrl="../default.aspx">Main Page</asp:hyperlink>

<asp:label id="Label1"

style="Z-INDEX: 103; LEFT: 945px; POSITION: absolute; TOP: 71px" runat="server"

Font-Names="Arial">As you type error highlighting</asp:label>

<rapidspellweb:rapidspellwinline ConsiderationRange="500" RightClickForMenu="true" id="RapidSpellWInline1" style="Z-INDEX: 104; LEFT: 813px; POSITION: absolute; TOP: 200px"

runat="server" ShowNoErrorsMessage="False" ShowButton="False" RapidSpellWInlineHelperPage="../rswihelper.aspx" TextComponentID="RapidSpellWInlineTextBox1" CheckAsYouType="True">

<Button BorderWidth="" BackColor="" ForeColor="" Height="" Width="" Enabled="True" BorderColor=""

CssClass="" type="button" value="Spell Check"></Button>

</rapidspellweb:rapidspellwinline>

</form>

</body>

</html>

 

Example 2 using a Repeater

ASPX

<%@ Page Language="C#" %>

<%@ Register TagPrefix="rapidspellweb" Namespace="Keyoti.RapidSpell" Assembly="Keyoti.RapidSpellWeb.ASP.NETv2" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>TextBoxHeight-AsYouType-RSWI</title>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="C#" name="CODE_LANGUAGE" />

<meta content="JavaScript" name="vs_defaultClientScript" />

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />

<script type="text/javascript">

function replacetext(rswtxt, txtid) {

var txt = $get(txtid);

rswtxt.SetText(txt.innerText);

}

</script>

<style type="text/css">

.mednote_entry

{

width: 210px;

margin-top: 8px;

margin-bottom: 8px;

}

</style>

<script>

function itb_blur(){

inlineTB.custom_shadow.value=inlineTB.GetText();

}

function tb_focus(tb){

var fr = inlineTB._getTBS().iframe;

rsw_updatePosition(fr, tb);

var w = rsw_getElementWidth(tb.id);

var h = rsw_getElementHeight(tb.id);

if((document.compatMode && document.compatMode!="BackCompat") || navigator.userAgent.indexOf("Gecko")>-1)//correct width when in strict mode

{

w = rsw_adjustOffsetWidthForStrict(inlineTB._getTBS().iframe, w);

h = rsw_adjustOffsetHeightForStrict(inlineTB._getTBS().iframe, h);

}

fr.style.width = w+"px";

fr.style.height = h+"px";

fr.style.backgroundColor = "white";

inlineTB.custom_shadow = tb;

inlineTB.SetText(tb.value);

inlineTB.Focus();

inlineTB._getTBS().spellChecker.OnSpellButtonClicked();

}

var inlineTB;

function RS_OnTextBoxesInitialized(){

inlineTB = <%= RapidSpellWInlineTextBox1.ClientSideObject %>;

inlineTB.OnBlur = itb_blur;

inlineTB.OnCorrection = itb_blur;

}

 

</script>

</head>

<body>

<form id="Form1" method="post" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">

</asp:ScriptManager>

<asp:Repeater ID="Repeater" runat="server" DataSourceID="XmlDataSource">

<ItemTemplate>

<strong>

<%# XPath("@name") %><br />

</strong>

<%#XPath("City")%><br />

<%#XPath("Antiquity")%><br />

<div class="mednote_entry">

<asp:TextBox ID="txtCity" runat="server" TabIndex="1" Font-Names="Verdana" Font-Size="10pt" style="overflow:auto;"

onFocus="tb_focus(this)" Height="53px" Width="195px" Text="textbox 1" TextMode="MultiLine" />

<br />

<asp:TextBox ID="TextBox1" runat="server" TabIndex="1" Font-Names="Verdana" Font-Size="10pt" style="overflow:auto;"

onFocus="tb_focus(this)" Height="53px" Width="195px" Text="textbox 2" TextMode="MultiLine" />

</div>

</ItemTemplate>

<SeparatorTemplate>

<hr />

</SeparatorTemplate>

</asp:Repeater>

<asp:XmlDataSource ID="XmlDataSource" runat="server" DataFile="Samples.xml" XPath="HistoricalPlaces/Place">

</asp:XmlDataSource>

<rapidspellweb:RapidSpellWInlineTextBox ID="RapidSpellWInlineTextBox1" runat="server"

Font-Names="Verdana" Font-Size="10pt" TextMode="MultiLine" Height="1px" Width="1px"

Style="z-index: 101; POSITION: absolute; left:-100px; top:-100px;" Text='<%#XPath("Comment")%>' />

<rapidspellweb:RapidSpellWInline ConsiderationRange="500" RightClickForMenu="true"

Font-Names="Verdana" Font-Size="10pt" ID="RapidSpellWInline1" Style="z-index: 104;"

runat="server" ShowButton="False" RapidSpellWInlineHelperPage="../rswihelper.aspx"

CheckAsYouType="True" CheckAsYouTypeOnPageLoad="false" TextComponentID="RapidSpellWInlineTextBox1">

<Button BorderWidth="" BackColor="" ForeColor="" Height="" Width="" Enabled="True"

BorderColor="" CssClass="" type="button" Value="Spell Check" ID="Button1"></Button>

</rapidspellweb:RapidSpellWInline>

</form>

</body>

</html>

 

Accompanying XML file (Samples.XML)

<?xml version="1.0" encoding="utf-8" ?>

<HistoricalPlaces>

<Place name="Taghe Bostan">

<City>Kermanshah</City>

<Antiquity>2000</Antiquity>

<Comment>mestake of tiping</Comment>

</Place>

<Place name="Persepolis">

<City>Shiraz</City>

<Antiquity>2500</Antiquity>

<Comment>Test for spellng woard</Comment>

</Place>

<Place name="Taghe Bostan">

<City>Kermanshah</City>

<Antiquity>2000</Antiquity>

<Comment>mestake of tiping</Comment>

</Place>

<Place name="Persepolis">

<City>Shiraz</City>

<Antiquity>2500</Antiquity>

<Comment>Test for spellng woard</Comment>

</Place>

</HistoricalPlaces>

 

 

 

If you have any trouble understanding how it works or how to apply it, please just email support, thank you.

 


Related Questions:

Attachments:

No attachments were found.