The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
<appSettings> |
<add key="GoogleMerchantID" value="xxxxx" /> |
<add key="GoogleMerchantKey" value="xxxxx" /> |
<add key="GoogleEnvironment" value="Sandbox" /> |
</appSettings> |
<add key="Events.Price" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="0" /> |
using Telerik.Events; |
using Telerik.Cms.Engine; |
using GCheckout.Checkout; |
using GCheckout.Util; |
public partial class Sitefinity_ControlTemplates_Events_ContentViewItemView : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
public void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) |
{ |
//Assign the event ID to the button's command argument, so it can be used later |
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) |
{ |
EventsManager manager = new EventsManager("Events"); |
IContent content = (IContent)e.Item.DataItem; |
GCheckoutButton button = (GCheckoutButton)e.Item.FindControl("GCheckoutButton1"); |
if (button != null) |
{ |
button.CommandName = "Select"; |
button.CommandArgument = content.ID.ToString(); |
//Subscribe to the button's click event |
button.Click += new ImageClickEventHandler(button_Click); |
} |
} |
} |
void button_Click(object sender, ImageClickEventArgs e) |
{ |
//Since this button is inside of a repeater, you must cast the sender object as a Google Checkout button |
GCheckoutButton GCheckoutButton1 = (GCheckoutButton)sender; |
//Get the ID of the event |
Guid EventID = new Guid(GCheckoutButton1.CommandArgument); |
if (EventID != null) |
{ |
EventsManager manager = new EventsManager("Events"); |
IContent content = manager.Content.GetContent(EventID); |
//Pass the event's name, description, left null here, price and quantity to Google Checkout |
CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest(); |
Req.AddItem(content.GetMetaData("Title").ToString(), String.Empty, Convert.ToDecimal(content.GetMetaData("Price")), 1); |
GCheckoutResponse Resp = Req.Send(); |
//Report any errors |
if (Resp.IsGood) |
{ |
Response.Redirect(Resp.RedirectUrl, true); |
} |
else |
{ |
Response.Write("ResponseXml = " + Resp.ResponseXml + "<br>"); |
Response.Write("ErrorMessage = " + Resp.ErrorMessage + "<br>"); |
} |
} |
} |
} |
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.