Solved

another form in a asp.net page

Posted on 2013-12-19
7
330 Views
Last Modified: 2013-12-22
I need to have this form work on a asp.net page the area surrounded with "<% form action %>"  I have the asp form tag and I need this other one

any help?


<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/LandingPage.master" AutoEventWireup="true" CodeFile="CPADonateInsideOneColumnWithVideo.aspx.cs" Inherits="Templates_InsidePages_InsideOneColumnWithVideo" %>

<%@ Register Assembly="Ektron.Cms.Controls" Namespace="Ektron.Cms.Controls" TagPrefix="CMS" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
       
                         
                        <%
                            <form name="PrePage" method = "post" action = "https://Some otherserver.net/payment/CatalogPayment.aspx">
                            <input type = "hidden" name = "LinkId" value ="3e" />
                            <input type = "image" src ="//myserver.net/images/donate-gray.gif" />
                            </form>
                        %>
                        </div>
                    </div>
            </section>
</asp:Content>
0
Comment
Question by:bcrooks
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 39730717
Its not possible.

You have 2 options that I know of:

1/ Put your second form outside the first form, but you can't do that when using masterpages.

2/ Use javascript to build a post a form when the submit button is clicked. Something like this:

	$('#calculate').click(function(){
	    $('body').append('<form action="http://some-other-server/etc.aspx" method="post" target="some-name" id="hidden_calc">'
			+'<input type="hidden" name="linkId" value="3e" />'
			+'<input type="submit" name="post form" value="post form" />'
			+'</form>');
			
		$('#hidden_calc').submit();
		$('#hidden_calc').remove();
		return false;
	});

Open in new window


There might be a third option, you may be able to do the postback from the server side - but that would be pretty complex.
0
 

Author Comment

by:bcrooks
ID: 39731914
if I do this - nothing shows
shouldn't  the img src be outside the click function?

<script type="text/javascript">
  $('#calculate').click(function(){
  $('body').append('<form action="https://Simple..net/payment/CatalogPayment.aspx" method="post" target="some-name" id="hidden_calc">'
+ '<input type="hidden" name="linkId" value="3e" />'
+ '<input type="image" src ="//content.net/images/donate-gray.gif" />'
+ '<input type="submit" name="post form" value="post form" />'
+ '</form>');
                  
                                $('#hidden_calc').submit();
                                $('#hidden_calc').remove();
                                return false;
                               });
                        </script>
0
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 39733033
The way this script is written is specifically not to show anyway - all it shows is a regular ASP.NET button, which calls this in its onclick handler. It should all happen so fast that you would never see anything anyway.

You may want to put your image on the page using an ASP.NET image button, then wire the onclick handler into this code?

It depends what you want to be visible and when.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:bcrooks
ID: 39733132
Sorry to be a pain, but we always want the button to show, then only activate upon click.

does that make sense?
0
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 39733142
Yes, that exactly what I explained, you put a regular asp.net image button on the page, visible, within the regular asp.net form. And you wire up its client side onclick function to call the javascript code I gave you.
0
 

Author Comment

by:bcrooks
ID: 39735185
That did it - thanks  
working completed code is below

 <asp:ImageButton ID="Button2" src="//someserver.net/images/donate-gray.gif" OnClientClick="script1()" runat="server" />
</div>

 <script type="text/javascript">
     function script1() {
         $('body').append('<form action="https://Simple.net/Payment.aspx" method="post" target="some-name" id="hidden_calc">'
         + '<input type="hidden" name="linkId" value="3e" />'
         + '<input type="submit" name="post form" value="post form" />'
         + '</form>');

         $('#hidden_calc').submit();
         $('#hidden_calc').remove();
         return false;
     };
 </script>
0
 

Author Closing Comment

by:bcrooks
ID: 39735188
Thanks again
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now