postback 数据库更新了 但是页面没有更新 必须点第二次才能看到上次页面的更新结果 使用了UpdatePanel和不使用都这样 我想要的是点了按钮事件 只点一下 数据库也更新 页面上的数据也立即更新 这里说下 我使用了存储过程 在网上看到貌似直接写SQL不存在这样的问题(没试过) 但是小弟存储过程和业务逻辑都写完了 不想改回来 所以在这里跪求原因以及解决方案 谢谢啊!
public partial class barket : System.Web.UI.UserControl
{
private string username= " ";
private int ishandled=0;
public string UserName {get{return username;}set{username=value;}}
public int isHandled { get { return ishandled; } set { ishandled = value; } }
protected void Page_Load(object sender, EventArgs e)
{
init_barket();
}
protected void lb_jszx_Click(object sender, EventArgs e)
{
Response.Redirect( "jszx.aspx ");
}
protected void lb_delAll_Click(object sender, EventArgs e)
{
Order myOrder = new Order();
List <OrderInfo> myOrderInfoList = myOrder.GetOrdersByUser(UserName, isHandled);
foreach (OrderInfo myOrderInfo in myOrderInfoList)
{
myOrder.DeleteOrder(myOrderInfo.OrderID);
}
}
protected void lb_modify_Click(object sender, EventArgs e)
{
Order myOrder = new Order();
List <OrderInfo> myOrderInfoList = myOrder.GetOrdersByUser(UserName, isHandled);
foreach (OrderInfo myOrderInfo in myOrderInfoList)
{
TextBox tb = (TextBox)FindControl( "c " + myOrderInfo.OrderID.ToString());
myOrderInfo.ProductCounts = int.Parse(tb.Text);
myOrder.UpdateOrder(myOrderInfo);
}
//Response.Write( " <script> document.location.href=document.location.href </script> ");