datasource in repeater
-
<%# DataBinder.Eval(Container.DataItem,"title")%>
<%#DataBinder.Eval(Container.DataItem,"ward")%>
In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire Council -
<%# DataBinder.Eval(Container.DataItem,"title")%>
<%#DataBinder.Eval(Container.DataItem,"ward")%>
In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire CouncilI haven't had any need to use the datalist before but I would imagine that it works much like the datagrid. Within the ItemDataBound event (which will fire for each row in the datasource) you will be able to do something like what you were already trying to do... Repeater rptTem = (Repeater)e.Item.FindControl("rptWards") Again, take a look at the ItemDataBound[^] event. I might be wrong, but I think you were just looking for it in the wrong place.
-
<%# DataBinder.Eval(Container.DataItem,"title")%>
<%#DataBinder.Eval(Container.DataItem,"ward")%>
In the code behind I want to set the datasource property of the repeater control. I have be trying to use the FindControl("rptWards") but I can't seem to get the right combination. Repeater rptTemp = new Repeater(); rptTemp = (Repeater)dlstConsultation.FindControl("rptWards"); rptTemp.DataSource=dvwWards; Error on line (rptTemp.DataSource=dvwWards) is 'Object reference not set to an instance of an object' I am coding in c#, can anybody point me in the right direction Robert T Turner South Gloucestershire Council