DatePicker no longer works after changing C # webapp to use homepage

I am working on a .Net / C # web application and have used javascript based calendar so that users can select dates. This is working fine.

Today I changed the code to include the main page, and the date picker that is called from the child page stops working, the problem is that the text field that returns the date is no longer valid because the form declaration is now on the main page.

The code href="javascript:;" onclick="calendarPicker('form1.TBApplyDate');" title="Select Date from Calendar">Select

"Error line: 1 Error: 'window.opener.document.form1.TBApplyDate' is null or not an object

I have seen many examples online to collect the text field client id and pass this in various permutations below, but always get the same error.

href="javascript:;" onclick="calendarPicker('ctl00_MainContent_TBApplyDate');" title="Select Date from Calendar">Select


href="javascript:;" onclick="calendarPicker(form1.<%=TBApplyDate.ClientID%>');" title="Select Date from Calendar">Select


- , ?

.

+3
2

, ""

jQuery ,

jquery :

$('[id$=myContrl]')

<a href="javascript:;" onclick="calendarPicker($('[id$=TBApplyDate]'));" title="Select Date from Calendar">Select</a>

Edit:

<a href="javascript:;" onclick="calendarPicker($('#<%= TBApplyDate.ClientID %>'));" title="Select Date from Calendar">Select</a>
+1

, , jQuery, . , @jmein, .

, - , ​​jquery.

0

Source: https://habr.com/ru/post/1734098/


All Articles