I seem to recall that you can set client ids to predictable?
Sent from my Windows Phone
------------------------------
From: Greg Keogh
Sent: 5/01/2012 12:06 PM
To: ozDotNet
Subject: RE: getElementById failing
I just noticed that the IDs don’t match. In the rendered page I see this:
function NoteCheck()
{
var text =
document.getElementById('ctl00_ContentPlaceHolder1_UMAuthRepeater_ctl01
_converseCtl_conitemCtl_textNote');
var btn =
document.getElementById('ctl00_ContentPlaceHolder1_UMAuthRepeater_ctl01_converseCtl_conitemCtl_btnConSave');
var len = text.value.length;
btn.disabled = (len == 0);
}
<td><input ...
id="ctl00_ContentPlaceHolder1_UMAuthRepeater_ctl02_converseCtl_conitemCtl_textNote"
onFocus="NoteCheck();" onKeyUp="NoteCheck();"
style="height:60px;width:300px;" /></td>
So my JavaScript logic is probably still correct, but the IDs don’t match.
I also tried <%=textNote.ClientID%> style syntax instead of string.Format,
but it makes no difference. I’ve not seen this mismatching ID problem
before, but at least I now know why it’s crashing, but don’t know the
underlying cause or cure.
Greg