c# - How to get value in code behind from javascript -
hello newbie in asp.net , trying textbox value in code behind unable here process doing there gridview in project , on rowclick calling script
function getselectedrow(lnk) { var row = lnk.parentnode.parentnode; var rowindex = row.rowindex - 1; var customerid = row.cells[0].innerhtml; var suggested_plan = row.cells[1].innerhtml; var plan_id = row.cells[5].innerhtml; var propsed = row.cells[3].innerhtml; var previouscost = row.cells[4].innerhtml; document.getelementbyid('<%=txt_lead_id.clientid %>').value = customerid; document.getelementbyid('<%=txt_suggested.clientid %>').value = suggested_plan; document.getelementbyid('<%=txt_suggested.clientid %>').title = plan_id; document.getelementbyid('<%=txt_previous.clientid %>').value = previouscost; document.getelementbyid('<%=txt_units.clientid %>').value = propsed; return false; } </script> and getting values in textboxes txt_lead_id , txt_suggested when in code behind getting string lead_id = txt_lead_id.text; lead_id giving me null values have no idea going wrong.
i think return false in end of javascript function (getselectedrow) causes this. return false prevents postback. postback causes information send server , can textbox.text() in code behind , use it. delete return false getselectedrow , check again.
Comments
Post a Comment