Gurus,
I have a situation that I need to assign the textbox value based on dropdown list’s selected value using JavaScript
Here Is my javascript function
<script language="javascript">
function MakeRowDirty(kp,id){
var kpVal = kp.options[kp.selectedIndex].value;
if (kpVal==-1)
{
document.getElementById(id).value = '0';
}
else
{
document.getElementById(id).value = '1';
}
}
</script>
This is how I am calling function
Dim dirty As New TextBox
dirty = e.Item.FindControl("txtDirty")
Dim kp As New MIDKeyPressDDL.KeyPressDDL // this is dropdown
kp = e.Item.FindControl("kpCodes")
kp.AfterKeypressOnChange = "MakeRowDirty(this,'" & dirty.UniqueID & "'); return showHideRiskFactors(this);"
it throws error : script5007 unable to set property 'value' of undefined or null reference---
else
{
document.getElementById(id).value = '1'; // here I am getting ...
Go to the complete details ...