Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

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.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -