2012-10-17 60 views
0

我填寫了一些控制,從數據庫數據,通過調用選擇方法更新控制場時網頁加載

,我改變這些值來更新它,但是當我按下更新按鈕,它需要調用該值在頁面加載時,忽略所有更改。

我該如何避免這種情況?

在此先感謝:)

這裏是一個簡單的代碼來提出我的問題

SelectBLL _selectbll; 
string _title = string.Empty; 
string _details = string.Empty; 


#region Page Load 
protected void Page_Load(object sender, EventArgs e) 
{ 
    GetUMedicineDetails(); 
} 
#endregion 

#region Get UMedicine Details 
private void GetUMedicineDetails() 
{ 
    _selectbll = new SelectBLL(); 
    _selectbll._GetUMedicineDetails(Request.QueryString[0].ToString(), ref _title, ref _details); 
    #region Bind Controls 
    txtdetails.Text = _details; 
    txttitle.Text = _title; 
    #endregion 
} 
#endregion 

#region Update Button 
protected void btnupdate_Click(object sender, EventArgs e) 
{ 
    _UpdateUMedicine(); 
} 
#endregion 

#region UpdateU Medicine 
public void _UpdateUMedicine() 
{ 
    _updatebll = new UpdateBLL(); 
    _updatebll._UpdateUMedicine(
     Convert.ToInt32(Request.QueryString[0]), txtdetails.Text, txttitle.Text); 
} 
#endregion 

回答

0

DataBind只有!Page.IsPostaBack

protected void Page_Load(object sender, EventArgs e) 
{ 
    if(!Page.IsPostaBack) 
     GetUMedicineDetails(); 
}