Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't access User-Control via javascript on the outer Page
    primarykey
    data
    text
    <p>I developed my user-control with a <code>label</code> and a <code>textbox</code> (both of them are from <code>DevExpress</code>). I have a page with some controls including mine and javascript block. I realize that I must use <code>document.getElementById("&lt;%=tbPosition.ClientID %&gt;")</code> to get access for user-control. But <code>document.getElementById("&lt;%=tbPosition.ClientID %&gt;")</code> returns null.</p> <p>Here's my code: 1) <code>Page.aspx</code> with user control</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; var tb = document.getElementById("&lt;%=tbPosition.ClientID %&gt;"); // returns null &lt;/script&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;rsoft:TextBoxControl ID="tbPosition" runat="server" Title="Позиция" IsRequired="true" ValidationMode="UnsignedInt" ClientIDMode="Static" /&gt; &lt;/body&gt; </code></pre> <p>2) User-control 'rsoft:TextBoxControl'</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td class="styleFieldLabel"&gt; &lt;asp:Label ID="lblTitle" Text="" runat="server" Font-Bold="True" /&gt; &amp;nbsp; &lt;/td&gt; &lt;td class="styleFieldInput"&gt; &lt;dx:ASPxTextBox ID="tbValue" runat="server" Width="500px" ClientIDMode="Static" ClientInstanceName="tbValue"&gt; &lt;ClientSideEvents TextChanged="tbValue_TextChanged" /&gt; &lt;ValidationSettings SetFocusOnError="True" Display="Dynamic" RequiredField-ErrorText="Поле обязательно для заполнения" ErrorTextPosition="Bottom" ValidateOnLeave="false" /&gt; &lt;/dx:ASPxTextBox&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p></p> <p>Does anybody know why <code>document.getElementById("&lt;%=tbPosition.TextBoxClientID %&gt;")</code> turns into <code>document.getElementById("tbPosition_tbValue")</code>, but there's an html element "tbPosition_tbValue_I" not "tbPosition_tbValue"? It occurs when i'm using DevExpress controls inside my user-control. When my control doesn't contain devexpress but usual <code>&lt;Asp:Textbox&gt;</code> I don't have this problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload