Okay so I did lot of playing around with code and used code by Stephen Anderson
here:
http://www.artisteer.com/Default.aspx?post_id=136690&p=forum_post
Im fairly new with asp.net but what I wanted to do was add as many articles i want and also be able to change their text from CS when ever i wanted.
Since i never figured out how to add text (html) in the article from CS but i did figure out how to add articles using Article newarticle = new Article() and then adding that to the SheetContentPlaceHolder controller
to sum it all up this is what i did to add 10 articles and change the 2nd articles text once they all were displayed
x = (ContentPlaceHolder)Master.FindControl("SheetContentPlaceHolder");
if (!IsPostBack) {
for (int i = 0; i < 10; i++) {
Literal a1 = new Literal();
Literal a2 = new Literal();
Literal a3 = new Literal();
a2.Text = BlocksAndArticles.ArticleEnd();
a1.Text = BlocksAndArticles.ArticleStart("Welcome" + i);
a3.Text = "<p>THIS IS MY TEXT first " + i + " <p>";
a1.ID = "Article"+i+"Start";
a2.ID = "Article"+i+"End";
a3.ID = "Ariticle"+i+"Text";
x.Controls.Add(a1);
x.Controls.Add(a3);
x.Controls.Add(a2);
}
}
Literal lol = (Literal)Master.FindControl("SheetContentPlaceHolder").FindControl("Ariticle1Text");
lol.Text = "<p>NOOOOOOOB</p>";
i apologize for the varibles and text it was just a test lol
anyway
if anyone has any ides to make my life easier ? something mybe im missing? thanks
Axar
|