473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Client-side and server side code

Hey Everyone,
I have a problem with a web application due to the use of both client-side
and server side script on the on-click event of a button. The client side
script runs first as expected however my problem is that this code runs and
brings up a Microsoft Internet Explorer Window telling the user they are
going to be charged for the search they are about to do. The user then has to
click ok or cancel. My problem with this is that I need the server-side
validation code to run before it. The validation has to be done server side
but I need it to kick in before the message to the user pops-up. I don't want
the message to come up at all if the user details aren't valid.
I don't mind changing my client side code if I have to in order to achieve
this.

Does any one know how I can achieve this? Does anyone know how to get
Internet Explorer messagesboxes popping using c# code in the code behind page
on the buttons onclick event.
Cheers for any help anyone can give me
Nov 16 '05 #1
1 2296
hi stephen,

As far as i have worked, there is not way to restrict the order in which the
client and server event is fired, the client events are fired first, b4 the
server.

But a workround for your case might be to render the java script from the
code behind class.

Try this code in the button click event.

Response.Write("<Script>alert('hi')</script>");
this shows an alert box on click of the button, you can play around with
your javascript to get the exact functionality what you wanted......

To add a confirm box to ur code, try this.

Button1.Attributes.Add("OnClick", "return confirm('Are you Sure you want to
delete this?');");

you can get the message box dialog result like this.
set the CommandArgument Property to some text and check the text in the
button click event.
If the text matches the user has clicked "OK", else cancel.

Ex:
Button1.CommandArgument = "YES";

private void Button1_Click(object sender, System.EventArgs e)
{
//returns "YES" when OK is clicked in the confirm window.
string str1 = ((Button)sender).CommandArgument;

if (str1 == "YES")
{
//add code to do task
}
else
{
//do someother task
}
}

Hope this helps,
Kannan.V [MCAD.net]

"Stephen" wrote:
Hey Everyone,
I have a problem with a web application due to the use of both client-side
and server side script on the on-click event of a button. The client side
script runs first as expected however my problem is that this code runs and
brings up a Microsoft Internet Explorer Window telling the user they are
going to be charged for the search they are about to do. The user then has to
click ok or cancel. My problem with this is that I need the server-side
validation code to run before it. The validation has to be done server side
but I need it to kick in before the message to the user pops-up. I don't want
the message to come up at all if the user details aren't valid.
I don't mind changing my client side code if I have to in order to achieve
this.

Does any one know how I can achieve this? Does anyone know how to get
Internet Explorer messagesboxes popping using c# code in the code behind page
on the buttons onclick event.
Cheers for any help anyone can give me

Nov 16 '05 #2

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

Similar topics

1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
4
by: Mike D | last post by:
I want to connect to an oracle database from my client pc, OS is win2k or XP. Can I connect to an oracle database without having the full oracle client installed? If so what would be the minimum...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info...
5
by: Paul H | last post by:
How do you folks get a reliable and complete brief of what is required before development starts? I am forever going back to a client once a project has started saying "Hang on, now that I've...
11
by: pshindle | last post by:
We have several machines currently running the DB2 V7 Run-time Client that we would like to actually be running the App Dev Client. To 'upgrade' (within the same version) this client software can...
2
by: J Huntley Palmer | last post by:
I am having a horrific time integrating uw-imap's c-client for imap support in php. The problem is a whole bunch of "Text relocation remains referenced against symbol" errors during linking....
1
by: WebServiceSecurity | last post by:
The issue involves the following technologies: - 1. .NET 2.0 Framework 2. WSE2.0 (WS-Security) 3. X.509 certificates 4. BEA Weblogic 8.1.5
3
by: rjha94 | last post by:
Hi I just installed the runtime client on my windows machine. when i go inside the SQLLIB\bin folder i can see db2.exe. is it possible to use this db2 bundled with runtime client for command line...
4
MMcCarthy
by: MMcCarthy | last post by:
http://bytes.com/images/howtos/projectscope_blocks.jpgAs a freelance IT consultant for over 10 years, I’ve come to appreciate well defined project scopes. A project scope is a common understanding...
11
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.