Rank: Advanced Member Groups: Member
Joined: 1/16/2009 Posts: 43
|
Hi, I ran into this message when I validate datepicker control on my form and it inserts the date values into a gridview which sits inside a callback panel. It all works fine and fills in my datagrid inside the callbackpanel when it meets my condition, except when the date doesn't meet my condition I want to excute this
(System.Windows.Forms.MessageBox.Show("Purchase date must be between 1/1/1800 and 12/31/2049");
and then I get this message below:
EO.Web.Controls Client Side Debug Message:
EO.Web control 'CallbackPanel2' error message (set ClientSideOnError to handle this error); The callback on 'CallBackPanel2' has failed due to a server side exception. Please check the server side code.
You can turn off this message by setting EO.Web.Runtime.DebugLevel to 0 (Not recommended for debug build)
however when I comment out my messagebox and replace it with a response.write it doesn't give me the error but doesn't write back to the page. Can someone tell me why the callback panel isn't liking this? Please help. Thanks in advance!
ps: here is my code
if (varPurchaseDate >= Convert.ToDateTime("1/1/1800") && varPurchaseDate <= Convert.ToDateTime("12/31/2049")) {} else { System.Windows.Forms.MessageBox.Show("Purchase date must be between '1/1/1800' and '12/31/2049'"); //Response.Write("Please enter a valid date"); //SetFocus(txtClaimDTPur); return; }
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Both your message box and response write code are wrong:
1. Your MessageBox code is for Windows.Forms. It has nothing to do with Web; 2. Response.Write can not be used during AJAX callback;
If you just want to display an error message, you can put a Label inside the CallbackPanel and then set the Label's Text property.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 1/16/2009 Posts: 43
|
ok I will do that...Great! thanks for your help!!!
|