Note that there are some explanatory texts on larger screens.

plurals
  1. POEdit mode in grid view can't find the textbox id using getElementById()
    text
    copied!<p>In my <code>gridview</code> I have a date column and in edit mode, I place there a date picker. The date picker is in javascript which uses a <code>getElementById()</code> to get/set the value on the textbox.</p> <p>This is the code of my <code>gridview</code> with the date picker if in edit mode:</p> <pre><code>&lt;asp:TemplateField HeaderText="Effective Date" HeaderStyle-CssClass="allWidth160" ItemStyle-HorizontalAlign="Center" ControlStyle-CssClass="txtCommon allWidth80 txtCenter"&gt; &lt;ItemTemplate&gt; &lt;asp:Label runat="server" ID="lblEffDate" Text='&lt;%#DataBinder.Eval(Container.DataItem, "EFF_DATE").ToString()%&gt;'&gt; &lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ClientIDMode="Static" ID="EffDate" runat="server" Text='&lt;%#Bind("EFF_DATE") %&gt;' /&gt; &lt;img alt="Calendar" src="../Images/DateTimePickerImg/cal.gif" style="cursor: pointer;" onclick="javascript: NewCssCal('txtEffDate')" /&gt; &lt;/EditItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>I included the javascript file in the HEAD:</p> <pre><code>&lt;script src="../Library/DateTimePicker.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>When I click the image calendar it has an error somewhere in DateTimePicker.js file which leads to this code:</p> <pre><code>exDateTime = document.getElementById(pCtrl).value; </code></pre> <p>Where <code>pCtrl</code> is txtEffDate. </p> <p>Error: <strong>Object required</strong></p> <p>It seems that it cannot see the object <code>txtEffDate</code> thats why it throws that error. I think that when it is in edit mode, it only show its drawing (the textbox appear) in the browser but its ID is still missing. Any thoughts? TIA</p>
 

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