I need to do some work with Javascript and my datagrid controls.
I want to do something like:
*************** *************** *************** ************
function CheckQuestion()
{
var checkBox = document.getEle mentById('_ctl0 _SecurityStanda rd');
if (checkBox.check ed)
{
dropDown = document.getEle mentById('_ctl0 _SecretQuestion ');
dropDown.disabl ed = false;
textBox = document.getEle mentById('_ctl0 _SecretQuestion Text');
textBox.value = "";
textBox.disable d = true;
}
else
{
dropDown = document.getEle mentById('_ctl0 _SecretQuestion ');
dropDown.disabl ed = true;
textBox = document.getEle mentById('_ctl0 _SecretQuestion Text');
textBox.disable d = false;
}
}
*************** *************** *************** *************** ***
The actual names are SecurityStandar d, not _ct10_SecurityS tandard.
This works fine if I know the actual name of the object.
But in a Datagrid I get something like:
<input id="JobBoardsGr id__ctl2_JobBoa rd" type="checkbox"
name="JobBoards Grid:_ctl2:JobB oard" onclick="Javasc ript:CheckQuest ion();" />
and the next row will be:
<input id="JobBoardsGr id__ctl3_JobBoa rd" type="checkbox"
name="JobBoards Grid:_ctl3:JobB oard" onclick="Javasc ript:CheckQuest ion();" />
Is there a way to know by what object is calling, what the name is and by
that, I could prepend the extra part to the name of all the other objects in
that DataGridItem?
I am setting up the object to call the function from an AttachScript from
the DataGrid
*************** *************** *************** *************** *******
Sub OnAttachScript( sender as Object, e as DataGridItemEve ntArgs)
if e.Item.ItemType = ListItemType.IT em Or _
e.Item.ItemType = ListItemType.Al ternatingItem then
Dim oImageButton as CheckBox = CType(e.Item.Fi ndControl("JobB oard"),
CheckBox)
oImageButton.At tributes.Add ("onClick","Jav ascript:CheckQu estion();")
end if
end Sub
*************** *************** *************** *************** *************** ****
Thanks,
Tom