T
tshad
I need to do some work with Javascript and my datagrid controls.
I want to do something like:
*********************************************************
function CheckQuestion()
{
var checkBox = document.getElementById('_ctl0_SecurityStandard');
if (checkBox.checked)
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = false;
textBox = document.getElementById('_ctl0_SecretQuestionText');
textBox.value = "";
textBox.disabled = true;
}
else
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = true;
textBox = document.getElementById('_ctl0_SecretQuestionText');
textBox.disabled = false;
}
}
***************************************************************
The actual names are SecurityStandard, not _ct10_SecurityStandard.
This works fine if I know the actual name of the object.
But in a Datagrid I get something like:
<input id="JobBoardsGrid__ctl2_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl2:JobBoard" onclick="Javascript:CheckQuestion();" />
and the next row will be:
<input id="JobBoardsGrid__ctl3_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl3:JobBoard" onclick="Javascript:CheckQuestion();" />
Is there a way to know 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 DataGridItemEventArgs)
if e.Item.ItemType = ListItemType.ITem Or _
e.Item.ItemType = ListItemType.AlternatingItem then
Dim oImageButton as CheckBox = CType(e.Item.FindControl("JobBoard"),
CheckBox)
oImageButton.Attributes.Add ("onClick","Javascript:CheckQuestion();")
end if
end Sub
*******************************************************************************
Thanks,
Tom
I want to do something like:
*********************************************************
function CheckQuestion()
{
var checkBox = document.getElementById('_ctl0_SecurityStandard');
if (checkBox.checked)
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = false;
textBox = document.getElementById('_ctl0_SecretQuestionText');
textBox.value = "";
textBox.disabled = true;
}
else
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = true;
textBox = document.getElementById('_ctl0_SecretQuestionText');
textBox.disabled = false;
}
}
***************************************************************
The actual names are SecurityStandard, not _ct10_SecurityStandard.
This works fine if I know the actual name of the object.
But in a Datagrid I get something like:
<input id="JobBoardsGrid__ctl2_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl2:JobBoard" onclick="Javascript:CheckQuestion();" />
and the next row will be:
<input id="JobBoardsGrid__ctl3_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl3:JobBoard" onclick="Javascript:CheckQuestion();" />
Is there a way to know 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 DataGridItemEventArgs)
if e.Item.ItemType = ListItemType.ITem Or _
e.Item.ItemType = ListItemType.AlternatingItem then
Dim oImageButton as CheckBox = CType(e.Item.FindControl("JobBoard"),
CheckBox)
oImageButton.Attributes.Add ("onClick","Javascript:CheckQuestion();")
end if
end Sub
*******************************************************************************
Thanks,
Tom