资源描述:
《数据捆绑技术 毕业论文外文翻译》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、英文原文TheDataBindingTechnologyInmyproject,IneedtoshowthedatafromtheDataBase,soIneedtousethedatabindingtechnologywhichMicrosoftcompanysupport.Inthefollowing,let'sdiscussittogether.IfyouarefamiliarwithclassicASP,thedeclarativedatabindingsyntaxintroducedinASP.NETwillbefamiliartoyoueventhoughthefunc
2、tionalityisvastlydifferent.Databindingexpressionsarethecodeyouseebetween<%#and%>charactersinanASPXfile.Theexpressionsallowyoutoeasilybindcontrolstodatasources,aswellasproperties,expressions,andresultsfrommethodcallsexposedbythepage.Whilethisfeatureiseasytouse,itoftencausessomeconfusionaboutwha
3、tisallowedandwhetheritshouldbeemployed.DatabindingbasicsDatabindingexpressionslinkASP.NETpageproperties,servercontrolproperties,anddatasourceswhenthepage'sDataBindmethodiscalled.Youcanplacedatabindingexpressionsonthevaluesideofanattribute/valuepairintheopeningtagofaservercontroloranywhereinthe
4、page.Alldatabindingexpressions,regardlessofwhereyouplacethem,mustbecontainedbetween<%#and%>characters.Whenusedwithdatacontrols(likeRepeater,DataGrid,andsoforth),theexpressionparameterisusuallyacolumnnamefromthedatasource.However,aslongasitreturnsavalue,anyvalidexpressionmaybeused.Likewise,the8
5、samesyntaxmaybeusedoutsidelistcontrols.Thisincludesdisplayingvaluesonthepageorpopulatingcontrolattributes.Container.DataItemisaruntimealiasfortheDataItemboundtoaspecificitem.Itmapstoanindividualitemfromthedatasourcelikeonerowfromadatabasequeryoranindividualelementfromanarray.Theactualdatatypef
6、ortheDataItemisdeterminedbythedatasource.So,ifyou'redealingwithanarrayofintegers,theDataItemwillbeaninteger.ThefollowinglistprovidesaquickreviewoftheVB.NETsyntaxforvariousscenarios:<%#Container.DataItem%>--Anarrayofstringvaluesisreturned.<%#Container.DataItem("expression")%>--Thespecificfieldf
7、romaDataViewcontainerisreturned.<%#Container.DataItem.PropertyName%>--Thespecificstringpropertyvalueofdatasourceisreturned.<%#CStr(Container.DataItem.PropertyName)%>--Returnsapropertyvalueconvertedtoitsstringrepresentation.Whenyou'reusi