When you click on an iron router link, MeteorJS will change the template that is being renderd into the page. this is not a traditional page reload.
how can i achieve this programically?
for example: i have a hyperlink defined by "{{pathFor 'settings'}}", clicking on it will change the template being displayed to the 'settings' template. but when i do this programatically with "window.location='http://localhost/settings'", a page refresh is triggered and any variables i may have initialised are gone.
i think i can achieve the result i want by adding a 'trigger click' event in jquery, but i was wondering if there is a better/simpler solution available
You have to use Router.go('settings');. You can either provide a path or a route name if you set one.
Related
Im adding flash message on form submit.
After successful submission im redirecting to route, then displaying the message via base twig template.
But when user goes to another location on the site and then clicks "back" button in the browser message is appearing again.
Is this normal behavior or im doing something wrong?
This is normal behavior since you're returning to a cached version of the previous page, unless it's over SSL or certain headers are set on the server.
What doest you "back" button like like ? Is it a proper link to go the previous page or something in javascript ? (In this case it would be a normal behaviour I assume)
i am facing one problem..
I have a page which has some templates related to user..
User use this template to send email..
User can have option to save this template and then he can load the saved templates...
What i want is on click on "Load Template" link. a new page appears which will display all the saved templates for logged in user. this page can contain grid. on select i want to close this load template page. and pass the text data back to previous page. which will display this template into text field. so that user can use saved templates.
How to do this using Asp.Net
You can do this using JavaScript, assuming the template selection window is opened with a call to window.open(). When the template is selected you can communicate and invoke methods (such as passing back the selected template ID) with code similar to this:
window.opener.templateSelected(selectedTemplateID);
window.close();
Here is information about window.opener
I believe that this may be what you're looking for. It's pretty straight forward and is in C#. It is done in .Net as opposed to client side JS.
I am trying to make a registration wizard that contains about 6 steps.
I have moved away from using the standard asp.net registration wizard as I want more control over the look and feel.
I am using the easyslider plugin as I want a back and forward button that allows the users to click through the steps and be able to go back and forwards.
So everything was going well until a added an asp.net button into the plug. When I click it the page postback isnt happening, Does the plugin stop the ability to use asp.net controls inside? Is there something else I need to do to enable the click event to fire when using this plugin?
Any advise would be great!
Thank you
Make sure your button is registered properly (eg : with a runat="server") in the aspx file.
Did you try to move that button outside of your wizard ? I never used easyslider but I guess, like most sliders, it "just" hides or shows partial part of the page so I see nothing that could prevent a post back from happening.
I am looking for a way to wire up an ASP:LinkButton to appear as a link but in the background (100% in the code behind, no dummy pre-filled form in the markup) do a form post (target=_blank). I have a form action, method and parameters to pass that I will query for in the "click" event of the LinkButton. What is the best way to accomplish this?
Well there are LOTS of ways to do what i think you are trying to do :)
One problem; standard pop-up's don't fire event handler calls as they are mapped via post-back to the page i believe.
If you are happy with GET only submissions:
OPTION A:
Add your link button with no target set and setup a post back event handler for click
setup your URL and pass it back to the page into a JS function that will load right away eg or use jquery etc.
in the JS function you load the URL using window.open() with the target set to "_blank"
EFFECT:
User clicks the link, all code is server-side that works out the URL to show, page refreshes back to where it was and a popup window then loads showing the new URL
OPTION B:
Setup the link to have target="_blank"
make it call a new page or the same page with a querystring argument you can pre-process in the page_load()
in the new page or controlling block of code, do your calculations and Response.Redirect() to the new target
EFFECT:
User clicks the link, no page refresh just a new popup right away with a redirect to the new page. This is a cleaner solution i think!
IF you need POST support:
Dynamically create either elements or a string of HTML representing a form with all the needed input elements and output it into the popup window (using option b as a rough start template) and have a onload submit the form right away which will perform a POST to the URL you decided via server-side script giving the same effect as option b but with a form level POST.
Using Drupal: When I click on button "Save" to save the changes to a page, the top of the back-end is immediately removed, and all the content is shifted up for some reason..
How can I fix this?
This sounds like some JavaScript code going haywire, attaching a handler to the form submit while it shouldn't. You should try to use the form with JavaScript disabled in the browser - if the behavior does not occur then, you need to check which JavaScript code is responsible for it. (Possibly some sloppy code from a contributed module - you can also turn off all contributed modules to see if this changes the behavior - if it does, turn them back on one by one to find the offender.)