جدیدترین سوالات

در قسمت 9 ویدیو یاد داده شد که چگونه دو تا ایتم به سبد خرید اضافه کنیم با این کد ها

  protected void AddToShoppingCart_Click(object sender, EventArgs e)
 
{

Button btn = (Button)sender;
if (Session["shoppingCart"]!= null)
{
Session["shoppingCart"] += "," + btn.ToolTip;
}
else
{
Session.Add("shoppingCart", btn.ToolTip);

}

// Response.Redirect("shoppingCart.aspx");
}


و این کد
protected void Page_Load(object sender, EventArgs e) { if (Session["status"] != null && Session["status"].ToString() == "Login") { //successful login sql_addedProds.SelectCommand = "SELECT * FROM [Products] WHERE ([id] in (" + Session["shoppingCart"].ToString() + "))"; } else { Response.Redirect("login.aspx"); } }
ولی وقتی دو ایتم یه سبد اضافه می کنم این ارور را می دهد
Server Error in '/' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.

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:


[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14286670
System.Number.ParseInt32(String s, Num
{
if (Session["status"] != null &&
Session["status"].ToString() == "Login")
{


//successful login
sql_addedProds.SelectCommand = "SELECT * FROM [Products] WHERE ([id] in ("
+ Session["shoppingCart"].ToString() + "))";


}
else
{
Response.Redirect("login.aspx");
}




سوال های تصادفی





جستجو در بانک سوالات
در این قسمت می توانید بخشی از متن سوال را وارد نموده و به دنبال سوال مورد نظر خود بگردید:

بخشی از متن سوال:

سوال در مورد طراحی سایت

من آموزش های شما رو در آپارات دنبال می کنم بخش طراحی سایت مقدماتی رو و تو بخش gavascript به مشکل بر خوردم خواستم ببینم مشکلم کجاست
این ارور رو در بخش console.log میده
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.



0
امتیاز

جواب های موجود برای این سوال:


ازین پس می توانید به کاربرانی که دوست دارید هدیه بدهید! کافیست بر روی علامت    در کنار تصویر آنها کلیک کنید!

1


جواب برای این سوال ثبت شده است!

تازه ترین


جواب ها رو اول نشون بده

پرامتیاز ترین


جواب ها رو اول نشون بده

1 جواب برای این سوال ثبت شده!

چینش بر اساس زمان ثبت


چینش بر اساس امتیاز



56
249
11

.:.soja.:.

سلام دوست عزیز

ببخشید بابت تاخیری که پیش اومد.... این دو خط رو توی بخش HEAD صفحه، توی کد HTML ات اضافه بکن:

 <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> 
<meta content="utf-8" http-equiv="encoding">
0
امتیاز




جواب تو چیه؟
userImage
کاربر میهمان
     
























پرسش سوال جدید :: تبلیغات در سوال و جواب :: گروه های سوال و جوابی

تمامی حقوق مادی و معنوی، متعلق به وب سایت سوال جواب (soja.ai) و تیم مدیریتی آن می باشد.

طراحی و اجرا : گروه مشاوران فناوری اطلاعات

پاسخ های موجود در سایت توسط کاربران سایت ثبت می شود،
سایت سوال و جواب هیچ مسئولیتی در قبال صحت و محتوی پاسخ ها ندارد، هرچند تا حد امکان نظارت بر محتوی آنها صورت می گیرد.