How to find the Postback URL for an ASP.Net page

by Joe Payne 29. February 2012 21:24

Some things are far more simple than you expect.  And far less documented than they should be.

All I want to know is what URL will the page post back to when a submit is fired.  It’s a simple thing.  It shouldn’t take me 45 minutes to find it in Google.  Well it did.

Finally, I found my answer.

Open the page source for the page in question. Find the <form> tag.

<form name="aspnetForm" method="post" action="/Checkout/Payment.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">

The action attribute contains the URL where the form data will be posted to when you click on the button in the web page.

Tags: , ,

AC7 Articles | Personal

How to loop through kit components for a product

by Joe Payne 15. February 2012 10:50

Here’s a quick code snippet that shows demonstrates how to loop through the kit components assigned to a product.  This is useful when you need to manually parse out something specific from the kit setup of a particular product.

// find the product associated with a particular kit choice 
int _KitProductId = -1;
foreach (ProductKitComponent _PKC in _Product.ProductKitComponents)
    KitComponent _KitComp = _PKC.KitComponent;
    foreach (KitProduct _KitProd in _KitComp.KitProducts)
        if (_KitProd.Quantity == 3) // any test you want to make here
            _KitProductId = _KitProd.KitProductId;
// if we didn't find a choice in the kit list for the given product, we cannot
// add this item to the basket at this time.  
if (_KitProductId == -1)
    ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Error,"CustomCode", "Could not find the product we wanted.");

Tags: , ,

AC7 Articles

Month List