473,320 Members | 1,820 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,320 software developers and data experts.

If control has both server/client side event

Hi,
I have a button control that has both server/client side events. There is a validation i'm doing in the client side "onclick" event that opens up an alertbox. Is there a way i can suppress the server side event(so no refresh occurs) to fire as soon as user clicks OK in the alert box.

Thank You.
Sep 6 '07 #1
5 1520
acoder
16,027 Expert Mod 8TB
'return false' should probably work. Post your code.
Sep 6 '07 #2
'return false' should probably work. Post your code.
Hi acoder,
I already tried return false but it doesn't work. First the alert box appears and then i get the page refresh which i dont want.

Expand|Select|Wrap|Line Numbers
  1. /////**** Client Side statements *****///////
  2.  
  3. <asp:button id="Button2" style="Z-INDEX: 110; LEFT: 787px; POSITION: absolute; TOP: 624px" runat="server" Width="64px" Text="OK" CssClass="button">
  4.  
  5. function validationCheck()
  6. {
  7.     var Associations = window["radtextAssociateWith"].GetValue();
  8.     if (Associations == "")
  9.     {
  10.         Alert("Please select something");
  11.         return false;
  12.     }
  13. }
  14.  
  15. /////***** Server side ****////////
  16.  
  17. Button2.Attributes.Add("onclick","javascript:validationCheck();");
  18.  
  19. private void Button2_Click(object sender, System.EventArgs e)
  20.         {
  21.  
  22. }
Sep 6 '07 #3
acoder
16,027 Expert Mod 8TB
I'm not too familiar with .NET. Where's the code that refreshes the page?

PS. Please use code tags when posting code.
Sep 7 '07 #4
I'm not too familiar with .NET. Where's the code that refreshes the page?

PS. Please use code tags when posting code.
The code on the server side inside this method causes the page refresh.
Expand|Select|Wrap|Line Numbers
  1. private void Button2_Click(object sender, System.EventArgs e)
  2.         {
  3.                // Some code
  4.         }
Sep 8 '07 #5
acoder
16,027 Expert Mod 8TB
I've copied this thread over to .NET too since it involves server-side code.
Sep 8 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ActiveUp | last post by:
http://www.activeup.com/products/components/activecalendar Active Calendar is an ASP.NET server control that allows users to select a date and/or time quickly using a professional looking date...
7
by: A.M | last post by:
Hi, I have a validation control in my page that upon any invalid data, it disables all buttons in the page. basicly i don't have any postback in the page if the validator finds any error. How...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
19
by: Sjaakie Helderhorst | last post by:
Hello, I need to add a Javascript event (onClick) to a servercontrol (asp:checkbox). Checkbox is named 'cbDoMail'. Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()") would do...
4
by: Barb | last post by:
I have a user control as my Save button for my page. When the Save button is clicked, I want some client-side validation to take place from a javascript function in the page, and then I'd like the...
6
by: Tim Westmoreland | last post by:
Can someone tell me how to raise an event or trap when the maxlength of a server side textbox has been reached?
3
by: Geoff | last post by:
I know how to add a client side event event handler to a webcontrol button using Attributes.Add, which gives me both client side and server side events. Sometimes I need to only do the client side...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
5
by: divingIn | last post by:
Hi, I have a button control that has both server/client side events. There is a validation i'm doing in the client side "onclick" event that opens up an alertbox. Is there a way i can suppress the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.