PDA

View Full Version : سوال: پیغام خطای viewstate برای listbox



sima_2n5k
سه شنبه 20 دی 1390, 12:14 عصر
سلام

من یه صفحه دارم که از مستر پیج استفاده میکنه داخلش یه listbox گذاشتم در زمان اضافه کردن ایتم مشکلی نیست ولی وقتی می خوام ویرایشش کنم بعد زدن دکمه حذف از listbox پیغام زیر رو میده بعدا برای کنترلهای دیگم تست کردم دیدم این پیغامو میده وقتی میخوام ویرایش کنم! لطفا کمکم کنید ممنون:


Server Error in '/' Application.

Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[HttpException (0x80004005): Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.] System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +327 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Control.LoadChildViewStateByIndex(Ar rayList childState) +148 System.Web.UI.Control.LoadViewStateRecursive(Objec t savedState) +225 System.Web.UI.Page.LoadAllState() +312 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +747

hamid_shrk
سه شنبه 20 دی 1390, 12:24 عصر
کدتون رو بذارید

sima_2n5k
سه شنبه 20 دی 1390, 14:33 عصر
مرسی تغییرش دادم.مشکلش با listbox نبود فقط کد قبلی را گذاشتم و دوباره اضافه کردم.الان داره درست کار میکنه!
یه سوالی میشه برای مقدار ایتمهایی که اضافه می کنمم به listbox بدم ؟
مثل این: تهران کد:2
که تو listbox فقط اسمش نمایش بده و کدشم باشه

hamid_shrk
سه شنبه 20 دی 1390, 14:37 عصر
رشمعث ایتمم
منظورتون value Item بود؟
یعنی چی خوب؟

sima_2n5k
سه شنبه 20 دی 1390, 15:06 عصر
اینم حل شد مرسی