

code here will be executed every time page loadedĪnd the code will only be executed when you first load your page. code here will be only executed the first time the page is loaded Therefore you can do: protected void Page_Load(object sender, EventArgs e) To fill your Dropbox when the page first loads you can use a property IsPostBack, which is false only when you load your page for the first time, so the statement (!IsPostBack) will return true when you first load the page. I suggest you only fill your Dropbox when the page first loads, and when some data is changed. Learn how to create docs, coordinate work, and use Paper to drive projects forward. When button call i want to get the selected value of dropbox but every time i get the first value due to pageload Guide to Dropbox Paper Well show you how easy it is to get up and running with Paper. If (int.TryParse(Session.ToString(), out TeacherId)) SubjectId = q.FirstOrDefault().Subject_Id Paper_Subject.DataValueField = "Subject_Id" Paper_Subject.DataTextField = "Subject_Name" Var q = from u in db.tbl_Subject select u The code is protected void Page_Load(object sender, EventArgs e) I use asp dropbox and fill the dropbox from database.but the value of dropbox change when click on button because the when event of button call first pageload code call and in pageload i fill the dropbox from database
