To trigger button event, you have to add this line of code in javascript.
document.getElementById("btn_newpl").click();
Your button must have runat="server"
and OnServerClick="btn_newpl_Click"
attributes.
If your problem is that the input
element is in javascript string, than you can extract the string value of input
and concatenate to your string on client side.
<input type="button" id="btn_newpl" value="submit"
OnServerClick="btn_newpl_Click"
runat="server" />
<script>
var tmp = document.createElement("div");
tmp.appendChild(document.getElementById('btn_newpl'));
google.maps.event.addListener(marker, "click", function (e) {
var infoWindow = new google.maps.InfoWindow({
content:
'<div><input type="text" id="txt_newpl" value="place name"/>' +
'</br>'+tmp.innerHTML+'</div>'
})
});
</script>
Please note that you don't actually call a C# function, you just trigger the click event on webforms and a postback to sever will be done. The server will figure out which event has been triggered and will execute the C# function.
Source: How to call a code behinds button click event using javascript