Featured post
asp.net - JavaScript update field in another UserControl -
i try explain better. have 1 user control in page, , inside have uc2 (modal pop up). , try achieve this: when close uc2(modal) try update fields on uc1. , works fine one(i have uc2(modal) , on button save onclientclick="saveinfoci()"), , in uc1 on top of page
function saveinfoci() { document.getelementbyid("<%=frmdata.findcontrol("txtimplementingci").clientid%>").value = document.getelementbyid("<%=uc2.getclientid%>").value; }
but because reuse control in place want update field. have 3 js function update 3 fields. , try when click save in uc2(modal) must execute 1 of 3 javascript f, update right field. don't want have 3 same uc difference in onclientclick="saveinfoci().
two problems: first, syntax off, when inside code behind can't use <%=
this.
second problem, time script executed (on top of page) elements still not exist. have change value in client side page load event.
so should work, though it's better done server side:
sb.append("window.onload = function() { document.getelementbyid('" + frmdata.findcontrol("txttextbox").clientid + "').value = document.getelementbyid('" + myusercontrol.getjs + "').value; };</")
also, don't need stringbuilder here.. use ordinary string instead.
- Get link
- X
- Other Apps
Comments
Post a Comment