Wich control to use and how to show the content from db
-
Dear all, I need your advice in this. The admin of my site can make some articles with images with the html editor and saves the html into the database. now i want to show the list of articles with the date added, sender, and a short part of the article(depending on the saved html, this can be text with maybe a image). ofter clicking a article, the user can see the entire article. my question is, what is the best way to do this? wich control to use to list the articles, and how can i show only a part of the article that can also contain a image in that list ? Thanks in advance.
-
Dear all, I need your advice in this. The admin of my site can make some articles with images with the html editor and saves the html into the database. now i want to show the list of articles with the date added, sender, and a short part of the article(depending on the saved html, this can be text with maybe a image). ofter clicking a article, the user can see the entire article. my question is, what is the best way to do this? wich control to use to list the articles, and how can i show only a part of the article that can also contain a image in that list ? Thanks in advance.
A Repeater or a DataList should be good for what you are trying to do. You just have to define the template with labels, image controls and maybe an html literal control. As far as displaying part of the article, since it is stored as html that makes it much more difficult. Unless you have some standards in terms of how the html is formatted, it will be difficult to pull a html fragment that renders properly. For instance if the article html uses nested divs and you only pull enough text that you leave off the closing div tags it would be a mess.
-
A Repeater or a DataList should be good for what you are trying to do. You just have to define the template with labels, image controls and maybe an html literal control. As far as displaying part of the article, since it is stored as html that makes it much more difficult. Unless you have some standards in terms of how the html is formatted, it will be difficult to pull a html fragment that renders properly. For instance if the article html uses nested divs and you only pull enough text that you leave off the closing div tags it would be a mess.