bahare g

bahare g

  • NA
  • 68
  • 0

public varibel

Feb 22 2011 1:59 AM
hi my firends
i have a web page.i want to define a varible that can use in all events in this form.
i write it such as below

partial class : System.Web.UI.Page

{


Tbl_List tb = new Tbl_sList();



{

 if (!page.ispostback)  tb.name="ajjj";

}


{

protected void btnSave_Click(object sender, EventArgs e)

{

response.write(tb.name);

}

}

once at first tb.name get value and when i click on btnsave this value is null.

How can i maintain value in this varible?

protected void Page_Load(object sender, EventArgs e)

Answers (2)