i want to connect one aspx webpage to another - asp.net

I want to connect one webpage to another using a command button called email. When the user clicks on the email button it should take them to another webpage where the user can select the emails they want to send to. Then they will click the OK button and it will return them to the previous webpage where they can type in their email and write a message and hit submit.

To do this, you can use the asp.net Session object. Session allows you to save information, such as a list of email addresses into memory, and retrieve them on another page.
Here's the basic article on Session, including a bunch of how-to's.
From a logic flow perspective:
Main form page loads
User completes one or more fields
User clicks "Select Emails" button
In the button click event handler, store all completed form values in Session, and redirect to second .aspx page
User selects some email addresses and clicks Okay
In code behind of email .aspx page, in your okay button click event handler, store which email addresses were selected in Session, then redirect back to the Main form.
During page load on the Main form, check for page is not postback, and if the session values exist, use them to populate the form.
During form submission (where an email should be created), use the email list previously set it Session, to populate the 'to' list.

Related

ASP.NET Multiple links validate

I have about 50 or so links similar to the following:
<asp:TableCell Font-Bold="true"><asp:Hyperlink ID="Hyperlink9" runat="server" CssClass="Hyptext" Name="HypLink1" TextDecorations="None" NavigateUrl="~/Folde1/Second.aspx" Text="Case Study 12 "/></asp:TableCell>
What I like to do is when the user clicks on the hyperlink, I like to validate that the user has permission to view the links. If so, they can view it. If not, a pop-up will come information them that they need to sign in order to view the links.
Questions
1) What is the best way when the user clicks on the HyperLink to do a server side click event. From what I seen,only a client side even can be done with the asp:Hyperlink. I like to then validate if they have permissions. If not, throw a pop-up window.
You should not do that. Instead, you should...
On server side, check to see if user is logged in...
if not logged in, provide login link and text "Login to see case studies".
if already logged in, provide links user has access to.
You need an onClick tag that points to a method. Create one event handler function and point all your hyperlinks to it. Once the event handler fires, cast the sender to Hyperlink and go from there.

How to add destination page URL in create user wizard button?

I am trying to customize the create user Wizard control in asp. What it does is redirecting me to a continue page after creating the user, but I want a custom page to be displayed after creating a page.... What can I do?
Handle CreatedUser event and then Response.Redirect()
or play with control's properties:
ContinueDestinationPageUrl Gets or sets the URL of the page that the user will see after clicking the Continue button on the success page.
FinishDestinationPageUrl Gets or sets the URL that the user is redirected to when they click the Finish button.

Is there a way to run a subroutine when a user clicks a link from an email?

My program currently sends out an email when a new "Contact" has been added to my application. This email includes a link that has the ContactID and will link to a page (Contacts.aspx). This Contacts.aspx has a Gridview with various contact records inside of it. Whenever a specific record is selected, it provides more information on that contact through a subroutine called LoadContact(int ContactID). It provides more information by showing a panel with various asp.net controls such as labels and checkboxes. My question is this:
Is it possible to set it up so that when the user clicks the link in the email, it takes them directly to the Contacts.aspx page and loads more information on that specific contact automatically rather than them having to click a specific record with that contactid?
you can add a parameter to the link
Contacts.aspx?myparameter=foo
and then in your Codebehind-File access this in the Page Load Event
Request.QueryString("myparameter")
With that information you can select specific Data in your Gridview

How to redirect iFrame after third part form submit?

I have a third party form that I can't control. I'm putting that form on my webpage via an iFrame. I am then trying to redirect that iFrame to a new page after the form has been submitted.
Example:
User visits my webpage. They enter their email in the web-form. They then hit submit. The iFrame is redirected to a page that displays "Thanks for confirming your email!" etc..
Essentially after they enter their email I want that iFrame to redirect to a different page. I don't know how to do it because I don't control the form. I was thinking maybe adding a button or function when they hit enter or click submit that it submits the form then after a set amount of time it r
This is considered cross site scripting http://en.wikipedia.org/wiki/Cross-site_scripting so I'm not sure if it will work. Maybe you could open the subscribe form in a modal(like this http://colorpowered.com/colorbox/) and then the user will close the modal when he wants.

How do I track the click on a button with an external PostBackUrl?

On one of my ASP.NET pages I have several asp:textbox fields. On this page there is a "confirm order" button with an external url set in its "PostBackUrl" property.
This works well, and the data is sent to the external site. Here comes the question; how do I know that the user clicked the "confirm order" button on "my side?" (I need this to update my order-status field). There is off course no postback happening on my page becasue the form is submitted to the external site.
Maybe it's possible to use some sort of jQuery to hook on the onclick-event that will call a page that will update my order-status?
You'll need to hook into the buttons onClick event, perform a client-side callback to either a web service or Page Method (depending on your preferred setup) on your server to track the click, before allowing the form submission to continue.
Better to set it up so that the button does perform a postback. Then in your click handler you can update your order-status, and then post the data to the third party.

Resources