Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

another form in a asp.net page

Posted on 2013-12-19
7
Medium Priority
?
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

704 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