User-832373396 posted
Hi <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="5" data-gr-id="5">dehset</g>,
Cookie is coming; Cokkie = 1-1-3,6-2-4,10-7-2... But,I can not properly print it.
How can i do press properly the 3rd column in a label ?
Sir, I guess that you want this,
Please refer to
HttpCookie arr = new HttpCookie("Cookie");
arr.Values["Cookie"] = "1-1-3,6-2-4,10-7-2";
arr.Expires = DateTime.Now.AddDays(1);
Response.Cookies.Add(arr);
Next
@{
string str = Request.Cookies["Cookie"]["Cookie"];
foreach (var b in str.Split(',').ToList()) {
<label>@b</label>
}
Then it generates this as shown below at page
<label>1-1-3</label>
<label>6-2-4</label>
<label>10-7-2</label>
and Way2
List<string> c = str.Split(',').ToList();
for (int i = 0; i < c.Count(); i++)
{
if (i == 2)
{<label>@c[i]</label>}
}
Way3
<label>@c[2]</label>
Welcome to back if any question with my code:)
With regards, Angelina Jolie