Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i store the label value of masterpage so that i can access from any other page from jquery .do i need to use session or cookie or something like that so that it is not lost when redirected to other pages

here is my code



C#
$(".left_bt").click(function () {

    var prodDetailID = $("[id*=lblProductID]", $(this).closest("div")).html();
    var keyName = $("[id*=lblKeyName]", $(this).closest("div")).html();
    var eshopPrice = $("[id*=lblEShopPrice]", $(this).closest("div")).html();

    //var ProductDetails = "("+ prodDetailID +")" + keyName + "/" + eshopPrice;

    var ProductDetails = "(" + prodDetailID + ")" + keyName +"\r\n" ;
    var InitialValue = $("[id*=lblShopProdID]").text()+"\r\n";
    var EshopTotalAmount;
    if (InitialValue == "No Product Selected") {
        $("[id*=lblShopProdID]").text(ProductDetails)+"\r\n";
        alert("Product Detailed: " + ProductDetails + " added successfully to cart");
    }
    else
    {
        var newInitialValue = $("[id*=lblShopProdID]").text() + "\r\n";;
        $("[id*=lblShopProdID]").text(newInitialValue + "\r\n" + ProductDetails);
        alert("Product Detailed: " + ProductDetails + " added successfully to cart");

    }




});





here lblshopprodid is the lable which has items that user has clicked but everytime i move to other pages it gets lost which should not be the case. how can i avoid this please help thanks in advance
Posted

1 solution

Yes, you'll have to store in session or cookie and then each time a page loads it will need to write to a hidden field since jquery is on the client side.

Or, you can put it in the query string.

Or, you can have a webservice that you call.

Lots of options.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900