Hi, I am displaying message in c# like this
Response.Write( "<script>al ert( 'Sum is 50' )</script>");
it is working fine,but it is not working when we take variable in aleart like
int a=25;
int b=25;
int sum=a+b;
Response.Write( "<script>alert( sum)</script>");
this is not working.
anyone can solve my problem.
Shailesh Kumar
5 1413
Hi, I am displaying message in c# like this
Response.Write( "<script>al ert( 'Sum is 50' )</script>");
it is working fine,but it is not working when we take variable in aleart like
int a=25;
int b=25;
int sum=a+b;
Response.Write( "<script>alert( sum)</script>");
this is not working.
anyone can solve my problem.
Shailesh Kumar
Try - Response.Write("<script>alert(''+sum)");
Plater 7,872
Recognized Expert Expert
sum is a variable in your c# code, not your javascript, so you will need something like: -
int a=25;
-
int b=25;
-
int sum=a+b;
-
-
Response.Write("<script>alert('"+sum.ToString()+"')</script>");
-
Note: that inside the alert() I have included the ' on either side of the contents and not just a "
(So it's a ' followed by a " then +sum.ToString() + then " then ' )
TRScheel 638
Recognized Expert Contributor
sum is a variable in your c# code, not your javascript, so you will need something like: -
int a=25;
-
int b=25;
-
int sum=a+b;
-
-
Response.Write("<script>alert('"+sum.ToString()+"')</script>");
-
Note: that inside the alert() I have included the ' on either side of the contents and not just a "
(So it's a ' followed by a " then +sum.ToString() + then " then ' )
Wouldn't it be easier to just write it like: -
Response.Write(string.Format("<script>alert('{0}')</script>", sum));
-
Plater 7,872
Recognized Expert Expert
Maybe, but I never liked the string formater. Reminds me too much of printf().
Wouldn't it be easier to just write it like: -
Response.Write(string.Format("<script>alert('{0}')</script>", sum));
-
TRScheel 638
Recognized Expert Contributor
Maybe, but I never liked the string formater. Reminds me too much of printf().
Ah, everyone has their quirks. I particularly like it. No right or wrong, I just thought in that example it would be easier to show what you were getting at like that.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul M |
last post by:
Hi there, i hope someone can help me out here..
I have a input screen where i want the user to enter text in 2 different
languages, english and macedonian.
How is it possible to make the macedonian input boxes so when you type into
them, it is entered into macedonian font?
I dont want the users to be downloading anything also.
thanks,
|
by: Waguih Boctor |
last post by:
Hi,
I have a number of ASP pages where some JPGs and GIFs are displaying in the
browser and some are not. I have included an excerpt from the HTML below. In
this example, the gif file at the bottom of the example is displaying (I
have others that don't), while the jpg file at the top isn't. Both files are
in the same folder (visible bith physical in WE and virtual in CM) as the
asp file itself. WHen not displaying, it displays instead...
|
by: euang |
last post by:
Hi,
I have been using access 2000 for two years on WINDOWS NT to display dynamic
aweb page using ASP
My ISP has now changed to Windows 2003, and I am having major problems
displaying information from MEMO fields within the Access 2000 database. I
have not had any problems before displaying MEMO fields on NT and have tried
various tips to resolve this issue but no luck so far. I was wondering if
anyone had come accross a similar...
|
by: Joe Price |
last post by:
Hi chaps
I've got an XML file, within that file i've embedded html code using
the
<!]>
tag
I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc
|
by: Yoshitha |
last post by:
hi
I have datalist control in my ASP.NET application
the problem here is
i have used a textbox with multiline true propertly when i enter data like
"fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd
jfdsjfksdjfksdjkfjsdfjksdjfsdjfd
fdsfhjsdhfjsdhfjf dsjf dsjfhjsdfhjksdh d fdsjf
hsdjkfhdjsfhsdjfh ds
| |
by: Carole MacDonald |
last post by:
There have been lots of posts on this topic, but I haven't been able
to apply any of the suggestions to my situation.
I have an .aspx page with a form on it that has several submit buttons
on it. Clicking a button will cause a web service action that returns
XML. I would like to display this XML response on the page with the
form. I know I can display XML in an IFRAME by pointing its source to
an XML file. But I'm streaming the XML...
|
by: Robert |
last post by:
Hello Accessors
I have some reports created in Access that are very good for what they do.
However, it seems to me that when you are displaying information you don't
need to print out that a printer-friendly report is not the best way to go.
So, I tried converting one of my Access reports to an Access form. I
selected the continuous view to allow displaying multple records but when I
went to define my sorting and grouping there was none...
|
by: Tomaz Koritnik |
last post by:
Hi
I have many short HTML files stored in a binary stream storage to display
descriptions for various items in application. HTML would be display inside
application using some .NET control or COM control (like Microsoft
WebBrowser). For each description there is one HTML file and along
description text, it contains links to related information. Clicking related
information would for example open new form in application and display some...
|
by: RAJ |
last post by:
In our multi-tier application, we have several ASP.NET user controls which
will update the same data source provided by middle tier logic.
In this particular scenario we have one user control displaying the contents
of the data source, whilst another control updates the datasource via a
command buttons implementation of 'Click', an event raised in the 'Handle
Postback Events' stage of the control execution life cycle (via the...
|
by: RichB |
last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am
trying to add a tabbed control to the page.
I have no problems within the aspx file, and can dynamically manipulate a
tabcontainer which has 1 panel already, however I want to try create the
TabPanels dynamically. I followed the advice here:
http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe
Stagner)
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |