ASP网站制作之DataGrid罕见存眷成绩办理计划
在实现ERP等高端的ASP应用时,用户需要提供核心的经营资料,需要ASP商有很高的信用度。楼上说交互性不好,太牵强了吧。在微软提供的一套框架中,利用asp做网站,开发效率高,使用人数少,减少不必要的开销。交互性是互动方式,是有开发人员决定的。datagrid|办理|成绩IntroductionTheDataGridWebservercontrolisapowerfultoolfordisplayinginformationfromadatasource.Itiseasytouse;youcandisplayeditabledatainaprofessional-lookinggridbysettingonlyafewproperties.Atthesametime,thegridhasasophisticatedobjectmodelthatprovidesyouwithgreatflexibilityinhowyoudisplaythedata.
Thispaperaddressessomeofthequestionsaboutcustomizinggriddisplaythatarecommonlyaskedinnewsgroups,onWebsites,andinotherdeveloperforums.Thetechniquesdescribedherearesometimesquitesimpleandatothertimessomewhatinvolved.Ineachcase,however,theyaddressaquestionofhowtogobeyondthebasicfunctionalityoftheDataGridcontrol.
Thispaperassumesthatyouarealreadyfamiliarwiththecontrol―howtoaddittoaformandconfigureittodisplaydata.Youshouldalsounderstandhowtoputarowinthegridintoeditmodeandotherbasictasks.(Fordetails,seeDataGridWebServerControl.)Finally,youwillfindithelpfultoknowhowtoworkwithtemplates―addingtemplatecolumnstothegridandlayoutoutcontrolsinsideatemplate.
WindowsFormsversusWebFormsDataGridControl
TheWebFormsDataGridcontrolisnotthesameastheWindowsFormsequivalent.Itisacommon(andnotunreasonable)assumptionthattheyarethesamecontrol,oratleasthaveidenticalfunctionality.However,theentireprogrammingparadigmforWebFormsisquitedifferentfromthatforWindowsForms.Forexample,WebFormspagesperformaroundtriptotheserverforanyprocessing;theymustmanagestate;theyfeatureaverydifferentdata-bindingmodel;andsoon.
Becauseofthesedifferences,therearealsosignificantdifferencesintheirrespectivecontrols,includingtheDataGridcontrol.Asageneralrule,theWebFormsDataGridcontrolincludeslessbuilt-infunctionality.AfewexamplesofdifferencesintheWebFormsDataGridcontrolare:
Itdoesnotinherentlysupportmaster-detaildatastructures.
AswithotherWebservercontrols,itdoesnotsupporttwo-waydatabinding.Ifyouwanttoupdatedata,youmustwritecodetodothisyourself.
Youcanonlyeditonerowatatime.
Itdoesnotinherentlysupportsorting,althoughitraiseseventsyoucanhandleinordertosortthegridcontents.
Ontheotherhand:
YoucanbindtheWebFormsDataGridtoanyobjectthatsupportstheIEnumerableinterface.
TheWebFormsDataGridcontrolsupportspaging.
ItiseasytocustomizetheappearanceandlayoutoftheWebFormsDataGridcontrolascomparedtotheWindowsFormsone.(Detailsareprovidedlaterinthispaper.)
ControllingColumnWidth,Height,andAlignment
Bydefault,theDataGridcontrolsizesrowsandcolumnstofittheoverallheightandwidththatyouhaveassignedtothegrid.Withintheoverallgridwidth,itsizescolumnsaccordingtothewidthofthecolumnheadingtext.Alldataisdisplayedleft-justifiedbydefault.
Tocontrolcolumncharacteristics,youshouldturnoffautocolumngenerationbysettingtheAutoGenerateColumnspropertytofalse.Infact,youshouldsetthispropertytotrueonlyforshort-termuses,suchasquickproof-of-conceptpagesordemonstrations.Forproductionapplications,youshouldaddcolumnsexplicitly.Theindividualcolumnscanbeboundcolumnsortemplatecolumns.
Tosetthecolumnwidth,youcreateastyleelementforthatcolumnandthensettheelementsWidthpropertytostandardunits(say,pixels).ThefollowingexampleshowsyouwhattheHTMLsyntaxlookslikeforanItemStyleelementwithitsWidthpropertyset.
<asp:BoundColumnDataField="title"SortExpression="title"
HeaderText="Title">
<ItemStyleWidth="100px"></ItemStyle>
</asp:BoundColumn>
Alternatively,youcandothesamethingbysettingtheItemStylepropertydirectlyintheelement,asinthefollowingexample:
<asp:BoundColumnItemStyle-Width="100px"DataField="title"
SortExpression="title"HeaderText="Title">
</asp:BoundColumn>
Youcansetalignmentusingthestyleelement,settingitto"Right,""Left,"andothervaluesdefinedintheHorizontalAlignenumeration.(InVisualStudio,alignmentisavailableforindividualcolumnsintheFormattabofthegridsPropertybuilder.)Thefollowingisanexample:
<asp:BoundColumnDataField="title"SortExpression="title"
HeaderText="Title">
<ItemStyleWidth="100px"HorizontalAlign="Right"></ItemStyle>
</asp:Bound</p>下一页>>
asp,jsp,php是web开发的三大技术,asp简单易用且有microsoft做靠山,jsp功能强大是因为有java支持,php则开源跨平台.在国内,asp应用范围最广,jsp发展势头最猛,php则处于劣势.这可能与公司的支持以及技术的培训有关. 接下来就不能纸上谈兵了,最好的方法其实是实践。实践,只能算是让你掌握语言特性用的。而提倡做实际的Project也不是太好,因为你还没有熟练的能力去综合各种技术,这样只能使你自己越来越迷糊。 掌握asp的特性而且一定要知道为什么。 ASP主要是用好六个对象,其实最主要的是用好其中两个:response和request,就可以随心所欲地控制网页变换和响应用户动作了。 我们必须明确一个大方向,不要只是停留在因为学而去学,我们应有方向应有目标. 多看多学多思。多看一些关于ASP的书籍,一方面可以扩展知识面一方面可以鉴借别人是如何掌握、运用ASP的;多学善于关注别人,向同学老师多多学习,不论知识的大小;多思则是要将学到的知识灵活运用。 交流是必要的,不管是生活还是学习我们都要试着去交流,通过交流我们可以学到很多我们自己本身所没有的知识,可以分享别人的经验甚至经历。 以HTML语言整合(HTML负责界面上,ASP则负责功能上)形成一个B/S(浏览器/服务器)模式的网页程序。 如何学好ASP,以前也有人问过,把回答给你转过来看看能否对你有帮助:
页:
[1]