473,657 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image/imagebutton client validation

Hi

is there any way i can call a clientside function for validation onClick of
a Image or imagebutton?
Right now my image or imagebutton is submitting to the server, even it
return false from the clientside function.

my sample code has,
..aspx code:
-------------
function validateme()
{
if ((document.Form 1.pwdOldPwd.val ue != "") ||
(document.Form1 .pwdNewPwd.valu e != "") || (document.Form1 .pwdRenterPwd.v alue
!= ""))
{
if (document.Form1 .pwdOldPwd.valu e == "")
{
htlOldPwd.inner Text = "Old Password Required";
document.Form1. pwdOldPwd.focus ();
return false;
}
else
htlNewPwd.inner Text = " ";
}
else
htlNewPwd.inner Text = " ";

return true;
}

<input type="image" id="imgSubmit" src="images/bt_changepasswo rd.gif"
runat="server" onServerClick = "submitme">

codebehind:
--------------
'imgSubmit.Attr ibutes.Add("onC lick", "if ( validateme() ) ")

Any ideas??

Thanks

Ganesh kolappan.


Nov 17 '05 #1
2 4956
Have you looked at client-side customvalidator s?
http://msdn.microsoft.com/library/de...datorclass.asp

Karl

"ganesh kolappan" <ho********@yah oo.com> wrote in message
news:Oe******** ******@TK2MSFTN GP10.phx.gbl...
Hi

is there any way i can call a clientside function for validation onClick of a Image or imagebutton?
Right now my image or imagebutton is submitting to the server, even it
return false from the clientside function.

my sample code has,
.aspx code:
-------------
function validateme()
{
if ((document.Form 1.pwdOldPwd.val ue != "") ||
(document.Form1 .pwdNewPwd.valu e != "") || (document.Form1 .pwdRenterPwd.v alue != ""))
{
if (document.Form1 .pwdOldPwd.valu e == "")
{
htlOldPwd.inner Text = "Old Password Required";
document.Form1. pwdOldPwd.focus ();
return false;
}
else
htlNewPwd.inner Text = " ";
}
else
htlNewPwd.inner Text = " ";

return true;
}

<input type="image" id="imgSubmit" src="images/bt_changepasswo rd.gif"
runat="server" onServerClick = "submitme">

codebehind:
--------------
'imgSubmit.Attr ibutes.Add("onC lick", "if ( validateme() ) ")

Any ideas??

Thanks

Ganesh kolappan.

Nov 17 '05 #2
....attribute.a dd("OnClick","r eturn validateMe();")
-----Original Message-----
Hi

is there any way i can call a clientside function for validation onClick ofa Image or imagebutton?
Right now my image or imagebutton is submitting to the server, even itreturn false from the clientside function.

my sample code has,
..aspx code:
-------------
function validateme()
{
if ((document.Form 1.pwdOldPwd.val ue != "") ||
(document.Form 1.pwdNewPwd.val ue != "") || (document.Form1 .pwdRenterPwd.v alue!= ""))
{
if (document.Form1 .pwdOldPwd.valu e == "")
{
htlOldPwd.inner Text = "Old Password Required";
document.Form1. pwdOldPwd.focus ();
return false;
}
else
htlNewPwd.inner Text = " ";
}
else
htlNewPwd.inner Text = " ";

return true;
}

<input type="image" id="imgSubmit" src="images/bt_changepasswo rd.gif"runat="serve r" onServerClick = "submitme">

codebehind:
--------------
'imgSubmit.Att ributes.Add("on Click", "if ( validateme () ) ")
Any ideas??

Thanks

Ganesh kolappan.


.

Nov 17 '05 #3

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

Similar topics

6
22121
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically I want to know how can I have the mousedown and mouseup buttons events. I think that I have to do this in JavaScript. Can you help me on this?
5
3859
by: Arthur Hsu | last post by:
Hello, I have an ImageButton that refers to an external image. How can I keep that image's aspect ratio when I set the ImageButton's size to 120x120? TIA, Arthur
3
3905
by: jens.buchta | last post by:
Hi! I'm using a DataGrid with a template column to display an Image inside of it. I'm hooking into its OnPrerender-Event to set the ImageURL-Property dynamically. Everything works just fine here, until I thought "It would be cool, if the user could click on that image..". So I replaced the Image-Control with an ImageButton. My Problem is, that the ImageButton doesn't fire any events. Any other
3
4405
by: Varangian | last post by:
How can I make a Image Click working before Page Load event? The Problem I'm getting is that I'm loading an ImageButton dynamically from a Web User Control. How can I make the Web User Control ImageButton return a value to the main Page ? Thanks and sorry for already posting this...
5
2624
by: Varangian | last post by:
Hi there experts, Is there a way to convert a System.Drawing.Image to an ImageButton. Maybe using ChangeType I don't know! Thank you
2
2448
by: CK | last post by:
Hello All, I am trying to extend the default asp:ImageButton to include an image for an enabled state and a second image for a disabled state. I currently did this by extending the ImageButton class in a custom control, creating a property for each of these images (EnabledImageUrl, DisabledImageUrl) and then overrode the Enabled property to change base.ImageUrl respectively. I am also trying to use Themes with this web site. The problem...
10
2381
by: Edwin Knoppert | last post by:
I have an asp.net imagebutton with a clickevent. I have enclosed an anchor around the image and a small text. If i click the image the event is executed (while the href of the anchor shows in the statusbar) If the user clicks the image or the text beneat it it should do the same, executing the image asp.net server event. I can manage this fine using javascript but the href must contain a character to get the mousehand.
9
4411
by: tshad | last post by:
Is there a way to display images (imageButtons or linkbuttons for instance) as a max size (200px by 50px) and not have it stretch the image? What I want to be able to do is limit the real estate an image can take up but not stretch the image if it happens to be 150px by 40. I am doing commands such as: <asp:ImageButton ID="CompanyLogo" onClick="Image_Click" Width="200px" Height="50px" runat="server"/>
0
2062
by: Sully | last post by:
Hi Guys, I have this about 98% done and I cannot get it work properly. I have a Repeater bound to a MySQL DataSource, inside the Repeater I have an ImageButton, outside the repeater I have a Image, code is below: <asp:Image ID="imgLarge" Name="imgLarge" runat="server" AlternateText="Large Custom Image" Height="300" Width="400" /> <asp:Repeater ID="rptSmall" runat="server" OnItemDataBound="rptSmall_ItemDataBound1">
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.