|
|
Sorry I think you misunderstood me... for e.g. error message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" renders as:
alert('Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index');
It should render as:
alert('Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index');
so as not to throw a javascript error.
I suppose I could use this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script languaue="javascript">alert('" + ex.Message.Replace("'", "").Replace("\r", "").Replace("\n", @"\n") + "');</script>");
Just thought there might be an easier solution...
Thanks
|
|
|
|
|
Use "\\n" . That makes the first two slashes the escape sequence, and the n a plain character.
|
|
|
|
|
To properly escape a string value that you put in a javascript string literal, you replace \ with \\ and ' with \'. Before that you can replace a line break with the escape code \n.
And don't use the language attribute in the script tag. It's been deprecated for many years.
this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script type="text/javascript">alert('" + ex.Message.Replace("\r\n", @"\n").Replace(@"\", @"\\").Replace("'", @"\'") + "');</script>");
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How to write client-side validation code?
E.G.
a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt)
identityDdl has 3 items: Indentity Card, Martial Certificate and other
when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check.
if the characters more than 300 of remarkTxt.
With CustomValidator How to validat on client?
How to verify the results back to the CustomValidator?
Thanks.
|
|
|
|
|
You can use javascript for it.get the control by its ID,then check the value and for correct format you can REGEX.
Cheers!!
Brij
|
|
|
|
|
I saw so many people write like this:
<script type="text/javascript">
function valComments_ClientValidate(source, args)
{
if (args.Value.length > 10)
args.IsValid = false;
else
args.IsValid = true;
}
</script>
But I try it not successful.
How to setting the page validat is true or false?
|
|
|
|
|
This looks OK. Do you have firebug installed? If yes, try to debug your JS.
|
|
|
|
|
Hi:
I am usig Calender extender control to select date.it works fine but the issue is while storing in SQL table the date is stored with Defaulttime like below:
"10/7/2008 12:00:00 AM".My Requirement is like if a customer calling yesterday 10.30AM .Today I am entering the Customer calldetails date " 20-10-08 " with time 10:30AM it has to be stored like 20-10-08 :10.30AM.I want to know the following details
1)Is there any control to select Date and Time simultaneously.
2)How to Enter the Date and Time in Storedprocedure.(Here the Time meant not default time but user defined time like 10:30AM.plz kindly let me know its very urgent.
Thanks
suresh
|
|
|
|
|
|
can anybody please guide me what are the key points to keep in mind while converting a desktop/client server application to a web appliation
and
next question of mine is in previous application developer has used more than 20 datatables to in which on the beggening he is filling the data from the different tables and then using them in the forms...
now what will be the alternative or best approach to do same functionality in the web so that each datatable is accessable in all froms....?????
1) do i have to fill all the datatables and keep them into sesssion if i do that will these session effect the website while loading time???
umerumerumer
|
|
|
|
|
Main thing to remember, desktop is stateful, web is stateless. And yes, holding 20 datatables in session will be bad for performance.
If really necessary (and if they are application general stuff), consider the cache.
|
|
|
|
|
mr_muskurahat wrote: can anybody please guide me what are the key points to keep in mind while converting a desktop/client server application to a web appliation
1. Web Application should be deployed in a central location (Web Server ) , so you need to maintain session for all user becase all user access the same application.
2. Look into server side and client side code. avaoid unnecessary post back to server.
mr_muskurahat wrote: 1) do i have to fill all the datatables and keep them into sesssion if i do that will these session effect the website while loading time???
Yes you can store your datatable in a session and can access from all of the appliction.
at the time of Storing Datatable in a session , you should consider about the datatable size and also session size etc., because it can damage your application performance.
If DataTable Data is same for all user and not frequently changed then you can Use Caching or Application Variable.
cheers,
Abhijit
|
|
|
|
|
For your first question
A: You need to keep in mind all the user based data,so need better session management(try to reduce session data per user).
B: Minimise the size of aspx pages becuse it can severely harm the perfomrmance of your application.
C: If you application is very secured,don't send the valuable data in plain text always encrypt it and use HTTPs.
And for second,
if they are shared for all users the use cache else it will be better to use some database smartly else you apllication is going to be very slow.
Hope your query will be resolved by this
Cheers!!
Brij
|
|
|
|
|
Hi,
I need to show message box(alert) with out use of javascript.
How should i get this?
Thanks in advance.
Regards,
Venkat
|
|
|
|
|
Use AJAX model Extender control then, which is heavy and time consuming
What is the problem in using javascript ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
AJAX Also uses javascript (aJAx)
You can embed a VBScript and display a messsagebox (MsgBox), however i'm not sure if all platforms support this messagebox.
|
|
|
|
|
I dont want any scriptting languages.Using only c#
|
|
|
|
|
Some browsers cannot support javascript.So only i need with out javascript.
|
|
|
|
|
You can't. Simple enough. Unless you just want it to open on the server...
You want dynamic things to happen on the client, must use script.
|
|
|
|
|
I don't think it can be done without any scripting language.you can do one thing,use javascript keeping in mind the browser on that your application going to be used.
Cheers!!
Brij
|
|
|
|
|
hi frnds
i need to know whether we have click event for web page close(X) button
|
|
|
|
|
|
There is no specific event that is going to call when you click X browser button to close the browser.
but you can write a javascript function that will check where the user has clicked depending on its X and Y co-ordinate
Please have a search on google for it i think you will get the code easily
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
coz i have to give opacity for my web page while closing the browser button
|
|
|
|