Passing Query string

nikita mahanty asked on July 15, 2015 14:34

I am want to modify repeater transformation. Which is showing list of product with ADD TO CART Button ,I have added one more CartItemSelector BUY NOW button also .Now I want to pass query string with ShoppingCartUrl ,so that in next page I can track which button is clicked.I want to do it in transformation not in .aspx page.

<uc1:CartItemSelector id="buyNowNew" runat="server" SKUID='<%# EvalInteger("SKUID") %>' SKUEnabled='<%# EvalBool("SKUEnabled") %>' AddToCartTooltip="Buy now" AddToCartLinkText="Buy Now" ShowProductOptions="false" StockVisible="false" ShoppingCartUrl="~/Special-Pages/BuyNowCheckout/Buy-Now-Page.aspx" />

<uc1:CartItemSelector id="addItem" runat="server" SKUID='<%# EvalInteger("SKUID") %>' SKUEnabled='<%# EvalBool("SKUEnabled") %>' AddToCartLinkText="Add to cart" ShoppingCartUrl="~/Special-Pages/1-Step-Checkout/Shopping-Cart.aspx" ShowProductOptions="false" />

I want to hide some webparts in redirected page according to the clicked button.So that want to I can implement macro in VISIBLE property to show and hide webparts according to the button ID.

Recent Answers


Virgil Carroll answered on July 15, 2015 15:51

In the above examples of the ShoppingCartUrl, you are sending each button to a different page. So because they are going to different pages, you would know which button was clicked. I understand you want to hide webparts on the arriving page, but are you doing this based on the button clicked or are you wanting to send some other parameter based on the product or user? I just want to understand what the querystring will accomplish if each button is navigating to a different checkout page.

A couple of thoughts on how you could do this (and I have not tried them).

First have you tried just getting the Request.Querystring object in some inline .NET code like <%=Request.Querystring("param")%>? Or writing some server side code in script tags (in the transformation) to get the Querystring and append it to the ShoppingCartUrl?

The second would be to put a place holder in the ShoppingCartUrl property such as '/Special-Pages/1-Step-Checkout/Shopping-Cart.aspx?param=[placeholder]' and replace the [placeholder] with the correct parameter using javascript (I do a lot with this by updating the UnitNumber field all the time). Not sure if the URL will throw an error when processing with the webpart logic, but worth a try.

If neither of those options work, I would say you will have to build your own CartItemSelector (inherit from the base webpart) and write your own ShoppingCartUrl handler for it.

Anyway if you want to clarify more, we might be able to help more.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.