asp.net - Set a property of a user control from repeater databound data -


I have a user control inside a repeater which is being forced by a sqldatasource I get the following error: Databesing ways As eval (), XPath (), and bind () can be used only in the context of a database control. Edit: Never Eggs on My Face I am getting this database error because I was compelling it somewhere in the attempt to redress my actual problem since last Friday, but I forgot about it.

What is my actual problem: User control is being compromised before the multiplier is set, it appears that they are never set. When I see that the property hits before being put on the property, for example, if I do not want to be & lt;% # EVAL ("Address_ID")% & gt; Before the user control I will see the displayed ID, but then the user control will display an empty despatlet, because it is passing the ID of 0.

  & lt; asp: SqlDataSource ID = "sqlFacilityAddresses" runat = "server" Detasorsmod = "dataset" Cynkammand type = "Sngrhitprosesr" select Krenmom = "SP_Facility_GetAddresses" connection string = "& lt;% $ Knekshntrestings: Trstaf_sig 2% & gt;" & Gt; & Lt; SelectParameters & gt; & Lt; Asp: parameter name = "feature_id" dbtv = "int 32" /> & Lt; / SelectParameters & gt; & Lt; / ASP: SQLDataSource & gt; & Lt; Asp: Repeater ID = "Add repeater" datasource id = "sqlFacilityAddresses" runat = "server" & gt; & Lt; ItemTemplate & gt; & Lt; Select: Address ID = "Address Control" run = "Server" Address ID = '& lt;% # Evil ("Address_ID")%> & gt; / & Gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt;    

You can handle codebehind the repeater can get a reference through UserControl And can set the property according to the object and your column Address_ID .

For example (this debug to see that type of your Detatim really Detarovdrishy in):

  sub-repeater Addreses_ItemDataBound (sender As Object, and Repeater AS IS ITEM AVER ARGUES) Perform the following logic for items' and optional items' this event has been raised for headers, footers, separators and items'. If (e. Itm. Itam type = list Itamtaipkaitim) or _ (e. Itm. Itam type = list Itamtaip.alineting items) so dim address Controntrol address control = Direct Sist (Ikaikti.amkfnd Control ( "address Control", address control) address control. Adresaidi = Direct Sist (e. items. Detaitm, Detaravdrishy) ( "Pta_aidi"). Tostryn End End End End End    < / Html>

Comments