473,388 Members | 948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Validating Tabstrip with Multipage Control

hi all,
i am using tabstrip with multipage control in asp.net.
i have put some textboxes on the first tab.
my requirement is that whenever user makes some changes in any of
textbox and moves to next tab without saving this data he should get
alert message and should be stopped on current tab itself.
For this i have written a javascript function and called it
onSelectedIndexChange event.
The Problem is that the function gives the alert message but not able
to restrict the user to current tab.
As soon as alert comes at the same time control of next tabs gets
visible.
i just want not to allow user to change the tab if anything is unsaved
on current page.
Thanx in Advance
Vikas

Jul 21 '05 #1
3 2006
If all controls use viewstate, the data should be saved for each control
(provided you are not using Page_Load as a catch all, as is oft done). Then,
you can use code behind to force the user back to the tab in question and
create a JavaScript popup from CodeBehind, either by attaching the JavaScript
code block to a container (panel, for example) or emitting through a control
on the page using the .NET script emission methods.

There is a possibility of controlling this on the client side, but you will
have to short circuit the tab strip to do so, as it emits its own JavaScript
(view source in your browser to see what I mean). To short circuit, you may
end up having to inherit and override the tabstrip. Not sure this is the best
use of time, as there is a way to handle the issue on the server side.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"vi******@yahoo.com" wrote:
hi all,
i am using tabstrip with multipage control in asp.net.
i have put some textboxes on the first tab.
my requirement is that whenever user makes some changes in any of
textbox and moves to next tab without saving this data he should get
alert message and should be stopped on current tab itself.
For this i have written a javascript function and called it
onSelectedIndexChange event.
The Problem is that the function gives the alert message but not able
to restrict the user to current tab.
As soon as alert comes at the same time control of next tabs gets
visible.
i just want not to allow user to change the tab if anything is unsaved
on current page.
Thanx in Advance
Vikas

Jul 21 '05 #2
Unfortunately, that seems to be very difficult with tabs. I had the same
issue with Windows Forms TabControl, and it kills me because I did solve it,
but it was very complicated, and I have lost the solution. There is (in the
Forms version, at least) a Validating event on the tab pages that sounds
like it would be perfect because there's a Cancel in the EventArgs, but it
turns out to be useless. It would fire when I didn't want it to, and not
fire when I did want it... apparently its idea of when it needed validation
had nothing to do with whether the controls on it were edited. I think it
reacted instead to whether controls had been added or removed from its
ControlCollection...

So I will keep a watch on this in hopes that someone has a simpler and
better solution. Otherwise, I'll have to re-do the complicated one that
involved keeping track of the old SelectedIndex, changing back, keeping
information about why the SelectedIndex had changed, so that if it was a
change-back it would display the Alert instead of the usual stuff (or maybe
on top of the usual stuff?), and then chaning AGAIN if they really wanted
to.... phew! There must be an easier way...

Rachel

<vi******@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
hi all,
i am using tabstrip with multipage control in asp.net.
i have put some textboxes on the first tab.
my requirement is that whenever user makes some changes in any of
textbox and moves to next tab without saving this data he should get
alert message and should be stopped on current tab itself.
For this i have written a javascript function and called it
onSelectedIndexChange event.
The Problem is that the function gives the alert message but not able
to restrict the user to current tab.
As soon as alert comes at the same time control of next tabs gets
visible.
i just want not to allow user to change the tab if anything is unsaved
on current page.
Thanx in Advance
Vikas

Jul 21 '05 #3
Thanx Gregory for your suggestion, but the problem is still there.

The method suggested by you redirects the user from codebehined to
unsaved tab but before redirecting it displays the html part of the tab
to which user clicked means when user clicks on new tab , controls of
new tab displays up but due to redirection it return back to unsaved
tab.
Is there any method available through which i can restrict user to
unsaved tab means the controls of new tab doesn't get displayed at all.

Vikas

Cowboy (Gregory A. Beamer) - MVP wrote:
If all controls use viewstate, the data should be saved for each control (provided you are not using Page_Load as a catch all, as is oft done). Then, you can use code behind to force the user back to the tab in question and create a JavaScript popup from CodeBehind, either by attaching the JavaScript code block to a container (panel, for example) or emitting through a control on the page using the .NET script emission methods.

There is a possibility of controlling this on the client side, but you will have to short circuit the tab strip to do so, as it emits its own JavaScript (view source in your browser to see what I mean). To short circuit, you may end up having to inherit and override the tabstrip. Not sure this is the best use of time, as there is a way to handle the issue on the server side.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"vi******@yahoo.com" wrote:
hi all,
i am using tabstrip with multipage control in asp.net.
i have put some textboxes on the first tab.
my requirement is that whenever user makes some changes in any of
textbox and moves to next tab without saving this data he should get alert message and should be stopped on current tab itself.
For this i have written a javascript function and called it
onSelectedIndexChange event.
The Problem is that the function gives the alert message but not able to restrict the user to current tab.
As soon as alert comes at the same time control of next tabs gets
visible.
i just want not to allow user to change the tab if anything is unsaved on current page.
Thanx in Advance
Vikas


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: floater55 | last post by:
So has anyone worked with the IE webcontrols much? I've found that they've come in very handy for Internet Explorer clients ... ON A WINDOWS PLATFORM ONLY! I've implemented the tabstrip control and...
1
by: szabelin | last post by:
Is it possible to dynamically add a PageView to MultiPage? TabStrip has items property, so Tab and TabSeparator can be added... how about adding PageView to MultiPage? If not possible please...
0
by: Do | last post by:
Hi, I'm using the Microsoft IE Web Control for tabstrip. After a user enters some data and submits it, I want to activate another tab (and in making that tab active, I will also show another...
0
by: Greg Taylor | last post by:
I'm using the IE webcontrols (obviously) trying to dynamically generate a tabstrip based of a DTS package. I can get the tabstrip to show if I assign the generation after the page completely loads...
3
by: DalePres | last post by:
I have an application that uses the Microsoft.Web.UI.WebControls.TabStrip and Multipage controls. When I test the app on my pc or on my client's development web servers the controls render...
0
by: sri_san | last post by:
Hello, I have a tabstrip/Multipage control. The data in the Multipage comes from the database. For some reason, even if the autopostbask is set to false, the tabtrip does a postback. Code ...
9
by: Phin | last post by:
Hi, I have spent some time trying to get the tabstrip and multipage to work (from the IE web controls). I read the article from:...
9
by: Mardy | last post by:
Hello I've been using the tabstrip and multipage controls and really like the way this combination allows users to switch between tabs without a postback. I'd like to get more detailed...
3
by: vikaskuk | last post by:
hi all, i am using tabstrip with multipage control in asp.net. i have put some textboxes on the first tab. my requirement is that whenever user makes some changes in any of textbox and moves...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.