c# - Retrieving keys and NewValues within a Formview with manual data binding -
i have formview binded in code file generic list. now, upon editing of record, wish access keys , newvalues out of formviewupdateeventargs
parameter of itemupdating
event handler method.
from i've tried , searched on internet of now, i've come know updated values available if formview set data source control on markup page else they'd null. true?
secondly, @ moment casting sender
object formview , individually filling each object property using findcontrol
method find , retrieve values present in controls. best way task?
as example, doing atm:
formview currentform = (formview)sender; listobject.id = new guid(((hiddenfield)(currentform.findcontrol("hdnid"))).value); listobject.name = ((textbox)(currentform.findcontrol("txtname"))).text;
thanks fellas!
based on doing suggest not use formview. formview's brilliant when working datasources, fail, when dealing manual bound data way are, overriding , manually building form, , simpler create html form , asp.net server side controls.
findcontrol
expensive operation , can become unwieldily. simple assigning value during loop of data server side control faster.
alternatively suggested, use objectdatasource
, bind data formview in way.
Comments
Post a Comment