Hi,
I have an ASP.NET page into which I programmatically insert some JavaScript code to some textboxes for each row in a GridView:
However, I am getting the following error when the JavaScript runs:
'ctl00_Main_grdVacation_ctl02_chkChanged' is undefined.
When I view the source, I do indeed have a checkbox with that id:
And where it is being passed as a parameter:
Would anyone happen to know why it is giving me this undefined error when I have an element with that ID? The only thing I can think of that might possibly be causing it is that I have the grid inside of a panel, which is nested inside an AJAX UpdatePanel. These panels then translate into <div> tags. But I still don't know what the solution could be.
Thx.
I have an ASP.NET page into which I programmatically insert some JavaScript code to some textboxes for each row in a GridView:
Code:
chkChanged = CType(e.Row.FindControl("chkChanged"), CheckBox)
leaveDateTextBox = CType(e.Row.FindControl("txtLeaveDate"), TextBox)
returnDateTextBox = CType(e.Row.FindControl("txtReturnDate"), TextBox)
leaveDateTextBox.Attributes.Add("onChange", "return markAsChanged(" + chkChanged.ClientID + ")")
returnDateTextBox.Attributes.Add("onChange", "return markAsChanged(" + chkChanged.ClientID + ")")
However, I am getting the following error when the JavaScript runs:
'ctl00_Main_grdVacation_ctl02_chkChanged' is undefined.
When I view the source, I do indeed have a checkbox with that id:
Code:
<span style="font-size:10px;">
<input id="ctl00_Main_grdVacation_ctl02_chkChanged" type="checkbox" name="ctl00$Main$grdVacation$ctl02$chkChanged" />
</span>
And where it is being passed as a parameter:
Code:
<input name="ctl00$Main$grdVacation$ctl02$txtReturnDate" type="text" value="2007/01/02 12:00:00 AM" id="ctl00_Main_grdVacation_ctl02_txtReturnDate" onChange="return markAsChanged(ctl00_Main_grdVacation_ctl02_chkChanged)" style="font-size:10px;width:64px;" />
Would anyone happen to know why it is giving me this undefined error when I have an element with that ID? The only thing I can think of that might possibly be causing it is that I have the grid inside of a panel, which is nested inside an AJAX UpdatePanel. These panels then translate into <div> tags. But I still don't know what the solution could be.
Thx.