我正在使用“gamabhana”语言脚本在TextBox中的“Marathi”语言中输入文本,该文本位于内容页面上,由于以下错误,我需要在加载前设置焦点: -
错误:Microsoft JScript运行时错误:“null”为null或不是对象。在加载页面时。它要求registertartupscript专注于该控件。
在母版页上查找内容页面上的控件: script type =“text / jscript”language =“jscript” gphObj1 =新gamabhanaPhoneticHandler('ctl00_MainContent_txtVoterName',' devanagari ','罗马','#gamabhana#');
脚本
任何想法?
答案 0 :(得分:1)
您可以在主页中找到内容页面中的控件,如下所示
TextBox txtBox = ContentPanel1.FindControl("txtVoterName") as TextBox;
if (txtBox != null)
{
...
}
答案 1 :(得分:1)
这里是已解决的代码......
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:DropDownList ID="drpLanguage" runat="server" onchange=" return LanguageList_onchange()">
<asp:ListItem value="english">English</asp:ListItem>
<asp:ListItem value="__malayalam__">Malayalam</asp:ListItem>
<asp:ListItem value="__bengoli__">Bengali</asp:ListItem>
<asp:ListItem value="__devanagari__">Hindi</asp:ListItem>
<asp:ListItem value="__gujarati__">Gujarati</asp:ListItem>
<asp:ListItem value="__gurumukhi__">Gurmukhi</asp:ListItem>
<asp:ListItem value="__odiya__">Oriya</asp:ListItem>
<%--<asp:ListItem value="tamil">Tamil</asp:ListItem>--%>
<asp:ListItem value="__telugu__">Telugu</asp:ListItem>
<asp:ListItem value="__kannada__">Kannada</asp:ListItem>
<asp:ListItem value="__urdu__">Urdu</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server" Height="136px" TextMode="MultiLine"
Width="203px"></asp:TextBox>
<br />
<br />
<br />
<br />
<%-- <script src="Scripts/fileio.js" type="text/javascript"></script>--%>
<script src="Scripts/GA0010.js" type="text/javascript"></script>
<script src="Scripts/GA0640.js" type="text/javascript"></script>
<script src="Scripts/GAcommunicator.js" type="text/javascript"></script>
<script src="Scripts/gamabhanaLib.js" type="text/javascript"></script>
<%--<script src="Scripts/gamabhanaSCHelper.js" type="text/javascript"></script>--%>
<script src="Scripts/GA1000.js" type="text/javascript"></script>
<%--<script src="Scripts/wysiwyg.js" type="text/javascript"></script>
--%>
<SCRIPT LANGUAGE=javascript>
var gp;
function LanguageList_onchange() {
var lang = document.getElementById('<%=drpLanguage.ClientID %>').value;
alert(lang);
gp = new gamabhanaPhoneticHandler('<%=TextBox1.ClientID %>', lang, '', '');
// gp.MrAutoCor = true;
// gp.UpdateAjaxSpellCheck(true);
////
}
//
//-->
</SCRIPT>
<br />
</asp:Content>
答案 2 :(得分:1)
使用波纹管链接并按照说明获得适当的答案 “http://www.codeproject.com/Articles/67944/Hindi-Marathi-Transliteration-ASP-NET-Custom-Contr”
第1步:从上面的链接向您的网站添加DLL引用。
步骤2:将标记前缀注册为:
<%@ Register Assembly="TransliterateTextboxControl" Namespace="TransliterateTextboxControl" TagPrefix="cc1" %>
第3步:将文本框应用于:
<cc1:TransliterateTextbox ID="searchExpressionTextBox" runat="server" Width="410px" CssClass="searchInputBoxes" Height="22px" EnableKeyboard="true" KeyboardLayout="ENGLISH" DestinationLanguage="ENGLISH" Text="">
</cc1:TransliterateTextbox>
步骤4:关于RadioButton checkChanged事件:
protected void Radio_CheckedChanged(object sender, EventArgs e)
{
searchExpressionTextBox.Text = string.Empty;
searchExpressionTextBox.KeyboardLayout = TransliterateTextbox.SupportedKeyboardLayouts.DEVANAGARI_PHONETIC;
searchExpressionTextBox.DestinationLanguage = TransliterateTextbox.SupportedLanguages.MARATHI;
}