Braintree payments using webforms - c#

Is it possible to use Braintree payments with ASP.NET Web Forms? Braintree provides an MVC example.
I tried this solution but it doesn't work properly. Here is my server side code and my template; I changed the original version a little bit.
The main problem is that there is no action when the submit button is clicked -- the page just reloads. Why?

I work at Braintree.
I wrote a simple webforms example using Transparent Redirect that might help you with your issue.
Looking at your code and what you are describing as the issue, I would guess SessionUtils.Instance.TransparentRedirectURL is returning an empty string or null, so when you post the form it goes back to the current page.

Related

How to force ASP.NET ChangePassword And PasswordRecovery control to use enter key?

In my company I have a ASP.NET web page where there is a ChangePasswordControl and a RecoveryPassword control. The problem now is that, when user filling out the data hits enter key on the keyboard he get's logged out instead of validating the user.
Normally I've used a Panel control and setup the default button there and this helped. But here the change password button is built in and there is no way to get the ID of it (or is it?). I generally started my web apps adventure with ASP.NET MVC so I do not know much about the ASP.NET Controls.
Could anyone help me? I've read somewhere on the net that I should do my own template?
But I don't know if it's the right approach, and I don't know how to do this templates and what's the idea behind this concept. I'm wondering if I should use some jQuery or Javascript to handle that, but maybe there is a simpler way to do that.
Thanks in advance.
Have a look at the solution outlined here

JavaScript generated web page issue

I have a problem with javascript generated web page. I have a web page on the internet that is generated by javascript. I am working on changing a web page using wpf web browser control. I have to make some changes to the web page by inserting jquery, and changing css and hiding some elements.
Here is the issue.
Application works ok most of the time, but sometimes, for reasons unknown, it does not change the css or hides the elements. I presume that it has something to do with the javascript that actually generates the page. My code is executed, but no changes are made, so I presume that the script cannot find the elements in the page because they do not exist in the page, at the time of the execution of my scripts. This is just an assumption.
I need help resolving this issue. I have tried delaying the execution of my scripts for n seconds, waiting for body.ready, document.ready and window.ready, but nothing helped. Also, I use wpf web browsers LoadCompleted event, but... From time to time, the script simply makes no effect on the page. Did somebody have this issue, does anyone have any idea how to solve it?
Thank you very much in advance...
When building single page apps, always use a framework like Backbone or Sammy.js together with Mustachejs (or Hogan.js) for templating.
Since we don't have any code to look at, if you're using jQuery, I suggest you check out .live() and .on() for attaching event handlers to elements you plan on loading into a div (making them clickable) etc.

ASP.NET Session variable not getting set on pages with Ajax extentions

Another day, another silly, newbie ASP.NET question...
In my ASP.NET web application, I've chosen the method of setting session variables and redirecting, when I need to carry-over values when moving to a new page. This had been working perfectly fine, but then I added-in the AjaxControlToolkit. Now, on pages that contain controls from that tool kit, the session variables do not get set upon redirect. A very strange thing. I can't immediately think of anything that would be causing the problem, save for some sort of strange name-collision thing, but I've put that thought to rest by trying it with nonsense names.
Here's some code samples... All I'm doing is:
Session["SearchTermText"] = search_term;
Response.Redirect("SearchResult.aspx", false);
...in the master page code-behind. It was working fine, before, and still works perfectly on pages that don't have the Ajax tool kit controls. Very, very odd.
I know that the Ajax round trips aren't somehow resetting all my session variables, because some of the already-set session data (my log-in, for example) sticks, even on the pages with the Ajax tool kit controls.
Has anyone seen anything like this?

ReBind Telerik RadGrid from RadToolBarButton +AJAX

I've been using Telerik Controls for a couple months now, and have yet to apply AJAX to any of my UserControls. While I've been learning, I've been doing full Postback's every time I need to Update a RadGrid or insert data. After getting my Web App looking the way I want it, I've realized that doing full Postback's not only looks bad, but it is quite slow.
At the moment all I am looking to do is ReBind a RadGrid using a refresh button on a RadToolBar. I am sure that once I grasp this, I will be able to apply AJAX to other places on my page.
I am currently running a Master Page, which consists of my Main Page, and my Main Page holds a RadTabStrip linked to a few other UserControls.
Does anyone know of any good (basic) tutorials that will aid me in learning AJAX with Telerik, as I am unfamiliar with both AJAX and Java, but am open to learning...
I recently run up into series of blog posts about AJAX and telerik ajax on their blogs - you can read them here. Also I know about a demo that does what you are asking for - toolbar incorporated into grid's command item, check it out.

Form POST in ASP.NET

I'm trying to convert a classic ASP page to ASP.NET 3.5. The page has several forms on it for several different things.
In ASP.NET, there's a server form control wrapping the entire page, and form controls don't work within a server form control, and you can't have more than one server form control on a page.
So in order to keep this functionality, I can either:
Remove the server form control that's wrapping the page, and leaving the html forms on the page.
Create button click events for every form and perform the POST in the code-behind.
What's the preferred method here?
I wonder if converting to vanilla asp.net (aka webforms) is a bad idea here. Personally I'd go to MVC instead - allows multiple forms etc, and the views are much closer to he HTML, a lot like ASP.
I guess I'm saying there are some glitches vanilla asp.net introduces that you don't have to suffer.
I would go with the second option, any button click is going to post the whole page back anyway so you're not saving any bandwidth. Simply handle each button appropriately.
Check the answer I provided to a similar question here :-)
How to get past embedding a html form for paypal buttons asp.net
If you're going to use different button clicks, you still need to use this override to disable the non-related buttons in each handler, otherwise it won't work. You can only have one form tag at a time - this way you can toggle/disable the ones you're not using as appropriate.
Better still, refactor your application to use a single form. While MVC would be a closer match to the model you're using right now, it wouldn't make sense to go that route unless you were experienced enough with it; Web Forms is an easier jump.

Categories