display error image?

Posted by Sagarp under JavaScript on 2/8/2010 | Views : 2259 | Status : [Member] | Replies : 10
Hi


i will try using java script on lode event if srting is equql display error image. on form tell me how can i do

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/



Responses

Posted by: Abhijit Jana on: 2/8/2010 [Member] [MVP] Bronze

Up
0
Down
Correct me If I am wrong, You want to show alert message if some string are equal in Page_Load Event ?

If yes, try like this

if(st1.equal(st2))

ClientScript.RegisterClientScriptBlock(typeof(Page), "myscript", "alert('Equla String')", true);


Let me know if you have any more issue.

Thanks !

Cheers !
Abhijit

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 2/8/2010 [Member] Bronze

Up
0
Down
but don't display alert will try to display error image

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit Jana on: 2/8/2010 [Member] [MVP] Bronze

Up
0
Down
Please show me your code snippet and Let me know if you have AJAX ScriptManager in your page.

Cheers !
Abhijit

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 2/8/2010 [Member] Bronze

Up
0
Down
using html not use sever control or ajax.simple i have check string is match create table using java script display image

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raja on: 2/8/2010 [Member] Starter

Up
0
Down
Below is the sample code for your solution.


<img src="/myimage.jpg" id="img1" />

<input type="button" value="submit" onclick="ChangeImage()" />

<script language="JavaScript">
function ChangeImage() {
alert(document.getElementById('img1').src);
document.getElementById('img1').src = "http://www.dotnetfunda.com/images/DotNetLogo.gif";
}
</script>


Clicking button will change the image of the <img> tag.

Thank you.

Regards,
Raja, USA

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 2/8/2010 [Member] Bronze

Up
0
Down
Hi raja,


i will use in form load event

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit Jana on: 2/8/2010 [Member] [MVP] Bronze

Up
0
Down
I think raja is quite correct, Call the JS function from Page load as I suggested, tell one think what is your exact scenarios , why you are not using any validation control ?

Cheers !
Abhijit

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/11/2010 [Member] Bronze

Up
0
Down
In page load have a checking condition and call the javascript function if that string occures.

ClientScript.RegisterClientScriptBlock(this.GetType(), "ClientScript", "showimage()"); 


In aspx add the script calling function as follows

<script language="JavaScript">

function showimage() { alert(document.getElementById(id of image).src); }
</script>


Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 2/11/2010 [Member] Bronze

Up
0
Down
stop reply i have solve that problem

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/12/2010 [Member] Bronze

Up
0
Down
Then mark it as resolved...

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Sagarp, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response