Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

AJAX UI and the old BACK BUTTON problem

Hi,

I googled "disable back button" and all solutions are fine for a standard ASP page but not for an AJAX UI. I can and do want to redirect my user to his last action inside my javascript code. But this of course only works if I can catch and reassign a new function to history.back(). Assigning a new function works (alert history.back gives me my code) but obviously the browser does not use it.

With AJAX this is a SERIOUS issue. Of course I can open the page in a new control less window, but even that at least the old IE with a tab add on screws up by opening the window in a tab.

So is there any solution for this ?

Thanks

Joe Robe

Hi,

While mainly focused on security, in one of the two (in the series of five), vids that are available on-demand already, Joe Stagner mentioned that they would be looking at this issue in an upcoming webcast. This is, after all security related, in that you need to know what is going to be executed - if and when. Beyond that, he mentioned that he is revising (again), the tutorial AJAX vids available in the Learn section of asp.net. Take a look at his site http://joeon.net for links for the on-demand webcast, or to sign up for the live Meeting editions still available (one a week, I think). As these have Q&A sessions, you'd have a shot at posting your question directly. Hope it helps. BTW, if you get a good answer - remember to pass it along. BRN..


In every page or in mater page add a script that will execute on page load. This script should imitate FORWARD button on the web browser. Note that it will do nothing if there is nothing in web-browser forward history. Since every page of your app tries to skip forward one page then one-by-one your browser will advance to the very last page in web-browser history.

history.go();


Take a look at Nikhils solution to this problem:

http://www.nikhilk.net/BackButtonSupport.aspx

Saturday, March 24, 2012

AJAX Time entry control

Are there any slick AJAX controls available that would allow a user to select a valid time i.e. 4:20PM? If so then how could I incorporate two of those controls to populate a text box with the time difference between the two values. So Control1 = 4:20PM ; Control2 = 4:30PM ; Textbox1 = 10minutes.

Thanks in advance.

http://www.asp.net/learn/ajax-videos/video-131.aspx

I found a good tutorial that pretty much solves my request to validate Time data entry. It uses the MaskedEdit control and the MaskedEditValidator control.

Now I just have to find the VB command that will do the arithmetic.


Nice one.

Vij

AJAX Textbox Extender

I'm using an AJAX textbox extender to present a masked textbox for the entry of Social Security numbers to the user. When the user tabs into it, it displays the mask and formats the data as it's entered, both of which are expected actions; however, when the user tabs away from the control to another control on the form, the formatting disappears and all that's displayed is the string of nine digits for the SSN.

Is there a way to force it to continue displaying the formatted SSN?

Doesn't anyone know the answer to my question?


Have you tried setting the ClearMaskOnLostFocus property to false? I think that should work for you, but if you access the .text property of the textbox, the mask characters will be in the string.

Hope that helps!

AJAX Tabs

I am using a tab container with four tab panels. On the first panel is my user information 10 fields 8 are required and have required field validators attached to them. On the second tab is a button that when clicked checks the 8 required fields for validity. If they are not all filled in I would like to have the first tab become the selected tab. Is there anyway to do this? Just starting to work with ajax so any hints would be greatly appreciated.

I'll give it a look tomorrow at work!

Just replying so it gets in my posts and I will remember ;)

I'll get back to you,
Wim.


Ok smitty,

I made a small working example.

(It could be that you have to change the tagprefixes of the controlToolkit extenders)

I got my inspiration here:

You could read them to get full understanding of what I'm doing in the code:

Calling ASP.net validators with javascript (http://www.codeproject.com/useritems/JavascriptValidation.asp)

Thank you so much. This has solved my problem.

Thanks

Wednesday, March 21, 2012

AJAX TabPanels and user defined controls

Hi,

I've built a control in which I implement the behaviour described in this video:How Do I: Trigger an UpdatePanel Refresh from a DropDownList Control? Basically, I want to update the nodes of a TreeView when I change the item in a DropDownList.

This works great except if I load the control dynamically into a tab panel...In this case, the first SelectedIndexChanged event doesn't trigger anything and all of the following events trigger a full page postback...

So, to sum this up:

    User control statically defined in a page -> OKUser control statically defined in a tab panel -> OK (it works when I put the code of the control inside the tab panel)User control dynamically loaded into a placeholder -> OK (using PlaceHolder1.Controls.Add(Page.LoadControl("WebUserControl.ascx"));)User control dynamically loaded into a tab panel -> NOT OK! (using both TabPanel1.Controls.Add(Page.LoadControl("WebUserControl.ascx")); and TabPanel1.ContentTemplate = Page.LoadTemplate("WebUserControl.ascx");)

I can't put the code of the control inside the tab panel statically (point 2 in the previous list) because the tab panels are being generated dynamically also...

Anyone has suggestions to solve this, please??

When are you adding these dynamically created controls? It sould be during the Page_Init event and not later (such as during the Page_Load).


I'm not adding the controls in the Page_Init as I can't do that...when my page first loads it has only a DropDownList with a list of options.

Then, when the selected option is changed, there is a postback (as the DropDownList has AutoPostBack = "True") and only then the tabs are created and the user control is loaded.

The user defined control is being rendered and is visible, but its behaviour is strange...


If you dynamically add your contorls into an updatepanel, the issue comes.

There are few good articles written byScott Mitchell on dynamically loading Controls which you will find in the following links:

Dynamic Controls in ASP.NETWorking with Dynamically Created ControlsDynamic Web Controls, Postbacks, and View State

AJAX TabContiner control

I am using the tabcontiner control, upon which I have placed 4 tabpanels. Based on the user clicking a button on one tab, I need to be able to disable all other tabs to prevent the user moving away unless they complete the operation, or cancel. I have tried to use the following

TabPanel1.Enabled =True

and

Me.TabContainer1.Tabs(0).Enabled =False

Unfortunately I have had no luck, any suggestions?

Michael.

When you set the TabPanel.Enabled = false it will disappear as I have just tested. I don't know if this is the desired effect that you are looking for or not.

You may want to set the AutoPostBack to true and then hook up an event to OnClientActiveTabChanged so that you can disable the other tabs. Of course you will want to wrap an update panel around the tabcontainer for a better client experience.

I hope this helps.


Hi Jim

Making the tabs disappear would be an acceptable solution, however, the above command will not even do this for me. I will give a look at your solution.

Michael.

Ajax Tab Container selected tab

I have a vb.net/asp.net 2005 app using an ajax tab container with tabs inside it.

I want the user to be able to click on a button as one way to get to the next tab. How do i display the next tab when the user clicks on a button.

Also, can I disable tabs where the user has not filled in information yet for the tab? IE: the user needs to fill in details on each tab page and the details are needed in sequence.

thanks.

Hi!

On the first one, you could put your TabContainer inside an UpdatePanel, set your button as a trigger and on the ButtonClick event set the TabContainer.ActiveTabIndex.

On the second one, you could use the same approach, using some kind of validation, catching the OnTextChangedEvent, so when you find that the user had filled up all the necessary information, you could enable a new TabPanel.
There are a couple of catchs here: Clicking on a TabPanel doesn't fire a post back to the server and I think that disabling a TabPanel won't just make it inactive, it will make it invisible. I'm not sure on the later, just give it a try.

Cherrs,