TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shiva Tiwari
NA
73
5.3k
remove item from cart
Jun 10 2020 3:17 AM
I am deleting item from cart through Jquery ajax,but it is not removing. It is returning "System.String[]";
[WebMethod(EnableSession =
true
)]
public
string
ClearItem(
string
Img)
{
try
{
if
(Session[
"Items"
] !=
null
)
{
string
[] session_item_arr = Session[
"Items"
].ToString().Split(
'|'
);
for
(
int
i = 0; i < session_item_arr.Length; i++)
{
string
[] key_arr = session_item_arr[i].Split(
','
);
foreach
(
string
item
in
key_arr)
{
if
(item == Img)
{
session_item_arr = session_item_arr.Where(val => val != session_item_arr[i]).ToArray();
}
}
bool
item_inedx = Array.Exists(session_item_arr, x => x == session_item_arr[i]);
if
(item_inedx)
{
Session[
"Items"
] = session_item_arr[i];
}
else
{
Session[
"Items"
] = session_item_arr;
}
}
}
}
catch
(Exception ex)
{
throw
ex;
}
return
Session[
"Items"
].ToString();
}
Reply
Answers (
1
)
How to change to static method to without static ?
How to open and display .eml file in ASP .NET C# in new tab