Author: Liming | Posted on: 10/28/2008 8:02:40 PM | Views : 299

Hello all, 
Quick question. Why the following two ways cause differences when I use PlaceHolder during postback?

#1)
1. protected void Page_Init(Object sender, EventArgs e)
2. {
3.         Literal testLiteral = new Literal();
4.         if (!Page.IsPostBack)
5.         {
6.            testLiteral.Text = "Text suppose to be coming from database. Should only be called once during !Page.IsPostBack";
7.        }
8.        TestPlaceHolder.Controls.Add(testLiteral);
9.}

*note: If I did like above, after  post back, my literal control's text were wiped out. <---- SOMETHING WRONG
 #2) 

1. protected void Page_Init(Object sender, EventArgs e)

2. {

3.&nbs ...

Go to the complete details ...