I am looking at somebody else’s code and in it there is a user control:
<UserControl:Comments ID="Comments1" runat="server" ObjectID="4" ObjectRecordID='<%#((Alert)Container.DataItem).AlertId %>'></UserControl:Comments>
What I don’t quite understand is how the value for ObjectRecordID gets assigned. I
understand by looking at the code that AlerId is getting assigned to ObjectRecordID
but how is ((Alert)Container.DataItem).AlertId grabbing its value?
Thanks.
Containerrefers to the parent control of the comment box, which would be a single “row” of the Repeater.Container.DataItemis a single object from the collection to which the Repeater is databound. Specifically, the object that is bound to the “row” being processed.(Alert)Container.DataItemtakes the DataItem and casts it as anAlertreference..AlertIdgrabs theAlertIdproperty of theAlertobject that resulted from the previous step, so that its value can be assigned to theObjectRecordIDproperty of theCommentscontrol.