SetFocus из MasterPage страницы содержимого TextBox - PullRequest
0 голосов
/ 16 сентября 2011

Я использую языковой скрипт "gamabhana" для ввода текста на языке "маратхи" в TextBox, который находится на странице содержимого, и мне нужно установить фокус перед загрузкой из-за следующей ошибки: -

Ошибка: Microsoft JScriptОшибка времени выполнения: «ноль» - ноль или не объект.при загрузке страницы.он требует, чтобы регистрstartupscript сфокусировался на этом элементе управления.

На главной странице, находящей элемент управления на странице содержимого: script деванагари ',' роман ',' #gamabhana # ');

сценарий

есть идеи?

Ответы [ 3 ]

1 голос
/ 25 мая 2012

вот решаемый код ...

<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>
1 голос
/ 25 мая 2012

Воспользуйтесь приведенной ниже ссылкой и следуйте инструкциям, которые вы получите соответствующий ответ "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;      
    }
1 голос
/ 16 сентября 2011

Вы можете найти элементы управления на странице контента с главной страницы, как это

TextBox txtBox = ContentPanel1.FindControl("txtVoterName") as TextBox;

if (txtBox != null)
{
   ...
} 
...