Respected Sir James HeatField,
Thanks for your reply it works but i have another problem regarding messagebox.This time i want to validate characters only.i.e.if anyone wiil be enter digits in the textbox it must show the messagebox.I tried this as follows but it could not work please sir send me the code for character validation.
function ValidateName(Obj){
if(((window.event.keycode<48 && window.event.keycode>57))){
var Value=Obj.value;
var len=Value.length;
}
else
{
alert("Please Enter Characters Only");
return false;
}}
Thanks & Regards
Prashant S. More
Prashant MorePosted May 12, 2008, 2:21 AM
Respected Sir,
Thanks for the reply but i want this type of code on keypress event and the you provide i could not understand very well so sir send me the code in a simple manner.
My EmailIds are
[email protected]
[email protected]
Thanks & Regards
Prashant S. More
Bechir BejaouiPosted May 10, 2008, 3:30 PM
1. Create a class and add these two methods to it :
2.
3. // for postback events
4. public static void ShowMessageBox(string _message)
5. {
6. Page page = HttpContext.Current.Handler as Page;
7. page.RegisterStartupScript("key2", "");
8. }
9.
10.// for async postback events
11. public static void ShowMessageBoxForAsync(string _message)
12. {
13. Page page = HttpContext.Current.Handler as Page;
14. ScriptManager.RegisterClientScriptBlock(page,page.GetType(), "key2", "alert('" + _message + "');", true);
15. }
16.
17.// Then you can call this in, let's say , button_click event handler like this ( i assume that your class name is Utilities without any namespace definition) :
18.protected void myButton_Click(object sender, EventArgs e)
19.{
20.Utilities.ShowMessageBox("you entered a wrong password");
21.}