print "$name now has age=$age , and now he live in $country";
Actually that's not in your original question. If you ask a question here make it to the point from the beginning so you don't need to add extra details later on.
To your question:
string name = "Michael Jackson";
int age = 20;
string country = "America";
string output = string.Format("{0} now has age = {1}, and now he lives in {2}", name, age.ToString(), country);
Literal1.Text = output;
where Literal1 is a Literal control you placed in your markup.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Marked as answer by kurniawanjoko on Nov 05, 2010 08:47 AM
// Declare new object variable.
Person p = new Person();
// Set object properties.
p.Name = "David";
p.Age = 30;
p.Country = "USA";
// You could then pass the whole object to a method...
Person.Update(p)
// Display property value.
Response.Write(p.Name);
// OR
// Display with label.
Label1.Text = string.Format("{0} now has age = {1}, and now he lives in {2}", p.Name, p.Age.ToString(), p.Country);
kurniawanjok...
Member
18 Points
15 Posts
Help :: asp string
Nov 05, 2010 07:58 AM|LINK
My name kurniawan joko purnomo from indonesia . I would ask about string.
How to write this code in asp
$name=joko;
print "my name is $name";
thanks alot .. i realy need and i dont know how to figure it.
Dave_Winches...
Contributor
3051 Points
716 Posts
Re: Help :: asp string
Nov 05, 2010 08:07 AM|LINK
Hi
Here you go - first in C#
and then VB.NET
Hope this helps.
David
Please mark as ANSWER if this is the solution.
vinz
All-Star
126896 Points
17922 Posts
MVP
Re: Help :: asp string
Nov 05, 2010 08:11 AM|LINK
You could also display the output in a Label like:
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
kurniawanjok...
Member
18 Points
15 Posts
Re: Help :: asp string
Nov 05, 2010 08:16 AM|LINK
Thanks for reply . But thats not i mean.
in php
$name="michael jackson";
$age=20;
$country="America";
print "$name now has age=$age , and now he live in $country";
XIII
All-Star
182674 Points
23445 Posts
ASPInsiders
Moderator
MVP
Re: Help :: asp string
Nov 05, 2010 08:27 AM|LINK
Hi,
Actually that's not in your original question. If you ask a question here make it to the point from the beginning so you don't need to add extra details later on.
To your question:
string name = "Michael Jackson";
int age = 20;
string country = "America";
string output = string.Format("{0} now has age = {1}, and now he lives in {2}", name, age.ToString(), country);
Literal1.Text = output;
where Literal1 is a Literal control you placed in your markup.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Dave_Winches...
Contributor
3051 Points
716 Posts
Re: Help :: asp string
Nov 05, 2010 08:27 AM|LINK
OK
// Declare new object variable. Person p = new Person(); // Set object properties. p.Name = "David"; p.Age = 30; p.Country = "USA"; // You could then pass the whole object to a method... Person.Update(p) // Display property value. Response.Write(p.Name); // OR // Display with label. Label1.Text = string.Format("{0} now has age = {1}, and now he lives in {2}", p.Name, p.Age.ToString(), p.Country);David
Please mark as ANSWER if this is the solution.