How to edit NEXT button functionality in Umbraco - c#

I'm using Umbraco forms and umbraco inplement the Next button automatically, I want to know if there is an option to custome/edit the button's functionality, all I could change is the button's name at the config...
"datasource": null,
"submitLabel": "good",
"nextLabel": "Future",
"prevLabel": "Past"

If you want to change the functionality when the user clicks the next button, then you'll probably need a custom workflowtype. Here you can define the workflow that gets executed once the form is submitted
Documentation on how to implement a custom workflowtype
https://our.umbraco.org/documentation/products/umbracoforms/developer/extending/adding-a-workflowtype

Related

ASP.NET WebForms WebSite - controls changes their's values in codebehind but not on frontend

I will try my best to express what I do not understand about WebForms. Maybe somone can explain it to me....
I work in 'quite big' WebForms (website) Application.
Application already has a PopUp (which I HAVE TO USE, because I dont have time to make a new one) like MessageBox in Winforms, but:
it's place is in MasterPage.master (I use it like ((MasterPage)Poup.Show("blablabla", yes_no));
I can add buttons to it and change style etc.
it doenst stop application (like .ShowDialog() in WinForms), so I have to assign onClick events dynamicly and assign/catch them on Page_Load to go to the wanted method depending on users input on form. At the moment i can't to anything about it.
And here is the problem:
Depending on form validation, if users press a button (on a form) - then form realods it's TextBox.Text's values and changes DropDownLists's SelectedIndexes and SelectedValues.
BUT IF YOU GO TO THE SAME METHOD WITH MY POPUP WINDOW:
ex: Do you confirm? YES/NO
If you press You press ANY button, then: CHANGES ARE VISIBLE BY CODEBEHIND BUT TEXTBOXES ARE STILL VISIBLE WITH PREVIOUS DATA ON THE SCREEN, ALSO DROPDOWNLISTS HAVE OLD VALUES SELECTED
BUT IF YOU PRESS A FORM BUTTON (WHATEVER WHICH), EVEN IF IT'S METHOD DOES NOTHING - ALL FORM WILL "RELOAD" AND HAVE PROPER DATA ON THE SCREEN.
(it's not about Runat="server" or AutoPostBack, I checked it)
I dont event know what to do about it :(
Update panels are used to partial refresh of some fields inside him, caused by certain triggers, like buttons, textchanged, etc.
See more about update panel's:
https://msdn.microsoft.com/en-us/library/bb399001.aspx
http://www.asp.net/web-forms/overview/older-versions-getting-started/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers
http://www.asp.net/ajax/documentation/live/tutorials/IntroductionUpdatePanel.aspx
(Haven't worked with web forms events in a while, just answering in case nobody else does.)
Out of curiosity, what happens if, in your javascript handler for your popop button, you getElementById one of the form buttons on the main page and call ".click()" on it?
The basic problem sounds like there's a runat/server form on the main page, with certain behaviors associated with it, which is submitted by the main page runat server buttons but not by your popup JS.
Easy enough to test with the above approach. If that works, take a step further and try to figure out why it worked, based on what those buttons are doing.
(If you're not using JS at all for the popup, then View Source the output HTML, because I'm sure it is. Backtracking those calls should help you understand the trace from popup button press to form submission.)
I probably mislead you by "OnClick", it's NOT javascript OnClick="method()" issue.
I mean ClickEvent on a button (in codebehind). For Ex. If form is validated I have to do:
ViewState["PopUpSelection"] = "yes_no";
(MasterPage)PopUp.Show("blabla",yes_no) //loads popup from MasterPage;
return;
then on Page_Load I have:
**if (string)ViewState["PopUpSelection"] == "yes_no"
{
ButtonConfirmYes.Click += new EventHandler(MyMethod);
}**
And if method "MyMethod" is called from a FORM button, everything "will go ok".
If you call the same method from PopUp button: changes are visible by codebehind, but on the screen nothing happens, unless i press ANY FORM BUTTON, whatever it does

Is there an event which fires when the Layout Details screen is opened?

I'd like to write some code that fires when the layout details screen is opened. Is there an event, some sort of API or some way to hijack Sitecore UI to allow me to do this? There's nothing in the Sitecore.config events sectiont hat looks relevant.
What I want to do is capture the ID of the item for which I'm currently updating so that I can use it in custom controls later on.
I'm using Sitecore 6.6.
Marek Musielak's answer is great. An alternative would be to change the command fired from the 'Details' Button - Look for item:setlayoutdetails in the commands.config.
You could create your own class that does your work then instantiates Sitecore.Shell.Framework.Commands.SetLayoutDetails afterwards.
You can override the \sitecore\shell\Applications\Content Manager\Dialogs\LayoutDetails\LayoutDetails.xml and change its code beside:
<CodeBeside
Type="Sitecore.Shell.Applications.ContentManager.Dialogs.LayoutDetails.LayoutDetailsForm,Sitecore.Client"/>
to inherit from your custom class that will simply inherits from LayoutDetailsForm and overrides e.g. OnLoad method.

How to make a touchable notice top bar in windows phone?

How to make a touchable notice top bar in windows phone ?
I am new to C# and windows phone world.So may be my question has a simple
way to solve,but I google a lot ,and didn't work out.
here is my purpose: I have a timer running throughout my app,it request a
service for notice info every one hour, and show a "notice bar" on the top of
screen.
it is easy to get the information ,but when I want to show them to the Page,
here is my problem:
1.
I used system tray to show my info.
It works,but then I found there is no touch or click event for Progress
Indication bar.
I even add an event to Touch.FrameReported in App.xaml.cs , but still ,
when i touch the system tray area, the event doesn't fire.
2.
Then I want to use a Dynamic way to achieve it: add a text block to the
current page
I got the current page handler ,but case I only know the current page
handler's type is PhoneApplicationPage, I can't get my Root UI element
(all my page has a root element named "LayoutRoot")
And when I try to use reflect method to get the "LayoutRoot" property,
the return value is null.
The code looks like this :
Type type = PhoneApplicationPageHandler.getType()<
//I checked,the type is my page's type
type.getProperty("LayoutRoot") or type.getField("LayoutRoot")
//they all return null
BTW: LayoutRoot is a grid, and it is described in my page's .xmal file.
Now My option is to make all my page inherit a defalut page ,in this page ,I will
implement a method to fulfill my second way to simulate a "touchable top bar".
but I think this coding is ugly .
So, can anyone tell me :
1.how to add touch event to a SystemTray
or
2.how to get a handler of an ui element which is described in xaml, while I only have a PhoneApplicationPage type handler of that page.
You may use
1) a toast prompt described here http://windowsphonegeek.com/articles/WP7-Toast-Prompt-in-depth
2)or shell toast described here http://www.c-sharpcorner.com/UploadFile/ae35ca/working-with-toast-notification-in%C2%A0windows-phone-7/ according to what suits your requirement the best. 3)You may also create a custom control which you may place on the top on your mainPage and handle its tap event accordingly.

Determining what controls needs to be recreated on page load when using multiple Update Panels

I have a page with multiple update panels, each containing dynamically created User Controls that contain a button control.
When The button in a control is clicked the control no longer exists in the page load event and so the click event of the button within the control cannot be raised.
To get round this I am currently recreating ALL the controls on the page in each page load event, but this is obviously causing a lot of unneccesary page updating. In any given partial postback, the only control(s) that need to be recreated are the ones in the update panel containing the control that has been clicked.
How then can I best identify which control has been clicked in page_load and then only recreate the controls in the relevant update panel to be able top then access the click event of that control?
I know I can do the following
if (ScriptManager1.IsInAsyncPostBack)
{
string clickedControlId = ScriptManager1.AsyncPostBackSourceElementID
}
But this isnt hugely useful as knowing the ID of the control doesnt neccesarily help me identify which Update Panel it belonged to. Is there a way of adding a command argument to the control when it is created at run time and reading that command argument in the page load event during the partial postback?
If not, any other suggestions?
Many thanks
Stewart
1) Stop using update panels they add an unnecessary level of complexity that creates more problems than is worth, especially when you have more than one in a page.
2) Stay away from mixing Ajax functionality with server-side logic. You will end up writing a lot of code to compensate one or the other.
What I suggest:
Don’t use update panels!
Keep the code that generates the initial page load. Instead of posting to the server with a .Net button, use a regular button and use the onClick=”foobar_ajax(id, ….Update UI)” to make an ajax call to update the data on the server. Include the ID of the item(the control) you are clicking on. When your ajax call is done you may not need to do anything or you could update the UI with some new data from the server (I recommend refreshing after saving).
Read: Calling the page method with jQuery instead.
http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/

c# Custom Control Navigation

I have a bunch of Custom Control Forms (i.e. login page, home page, etc.) that I want to be embedded within a "main form". Every time the user navigates to another page, only the content of the "main form" gets changed.
But the only way I can do this is to copy the contents of the Custom Controls and paste them into the "main form" - which is messy. Is there a standard way of doing this type of thing?
Update:
Ok it sounds like possibly you want to use an MDI form or maybe to use user controls (switching out controls for the new pages and such).
Old:
Is it possible you are talking about ASP.net pages and wanting to use master pages?
You might want to use a Panel. Put all the controls for each “embedded form” in a panel of its own. Then you can just show and hide the right panel to make controls appear and disappear.
Alternatively, if you want the user to be able to manually switch between the “pages”, you could consider using a TabControl.

Categories

Resources