If you're using a DataGrid, try this:
In the aspx file:
<asp:datagrid id="DataGrid1" OnItemDataBound="DataGrid1_ItemDataBound" ...
...
<script type="text/javascript">
<!--
function checkBoxOnClick(elementRef, textBoxId)
{
var textBoxRef = document.getElementById(textBoxId);
textBoxRef.style.display = (elementRef.checked == true) ? 'inline' : 'none';
}
// -->
</script>
CodeBehind file:
protected void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if ( e.Item.ItemIndex >= 0 )
{
CheckBox checkBox = (CheckBox)e.Item.FindControl("CheckBox1");
TextBox textBox = (TextBox)e.Item.FindControl("TextBox1");
if ( (checkBox != null) && (textBox != null) )
{
checkBox.Attributes.Add("onclick", "show('" + checkBox.ClientID + "','" + textBox.ClientID + "');");
}
}
}
NC...