Solved

another form in a asp.net page

Posted on 2013-12-19
7
340 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET data base connection 35 95
Need a quick overview of Selenium testing 2 35
Datagridview column resizing 8 28
Easiest intro into .NET CORE? 2 32
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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