Search code examples
asp.netrepeater

asp.net: How to find repeater div in backend?


I use repeater to display records fetching from database, especially I use div tag to display html content stored in datatable. But I don't know how to find the div in backend. In Repeater_ItemDataBound event I can use

Control divControl=e.Item.FindControl("divControl"); 

to get it but it does not have innerHtml property to set html content. Does anyone know how to get it as a div control?


Solution

  • HtmlGenericControl defines the methods, properties, and events for all HTML server control elements not represented by a specific .NET Framework class.

    So if its a server control you can simply use:

    HtmlGenericControl divControl = e.Item.FindControl("divControl") as HtmlGenericControl;