I have a label called dateLabel that displays when did a user last time got logged in:
dateLabel.Text = "Sist gang logget inn: " + string.Format("{0:d}\n{0:T}", Session["LastLoginDate"].ToString());
What i want i to display the information in 2 different lines. In the first the date and in the one below the time.
How should i modify my code to achieve this?
Does it mind if i use a label, or maybe i should use another component?
Currently in that output there is a duplicate, but i don't understand why, how can i avoid that?
Current output:
Desired output:
Can someone give me some tips?
Replace \n with <br/>
Also replace
Session["LastLoginDate"].ToString()
with
(DateTime)Session["LastLoginDate"]
dateLabel.Text = string.Format("Sist gang logget inn:{1}{0:d}{1}{0:T}",
Session["LastLoginDate"],
"<br/>");
#sfrj as far as i know its not possible to wrap the text on asp:label control you can try a text box control instead read on the following link
http://geekswithblogs.net/StealThisCode/archive/2006/03/21/WrapLabels.aspx
Related
I am working on a project for school. I have to create and SQL statement and then use a while loop to input information into a label. Every thing is working correctly except when you search for a new item, the label still displays the result from the last search. Code Picture Second Result Picture
Any way to fix this?
You should clear the label's text before you start looping.
you need to clear the label text first then show the result on it.
label1.text="";
You need to clear before start a new loop.
Try this:
Nameofyourlabel.Text = "";
I want to replace my values in text box without deleting them, for example, I output in my text box time "HH:mm:ss" and if I type in that textbox first number I would like to change "H" on it, and so on. How can i do that?
I don't ask code, just an advice.
/*I am reading many files and getting data through File.ReadAllLines. Now I want to search in these files for a specific string written in a textbox. Whenever I put some text in the textbox it must return lines of text containing that word. I am coding in textchanged property but it is not successful as it gives me a result even when I press backspace or add any other word. */
I have successfully made it to work. I was clearing the listbox every time it runs else statement. Now I just want you people to tel me what should I do to make it work fast.
if you don't want to get the result right away when you type something in Textbox then put Button on your form and try this code:
string[] lines=File.ReadAllLines(path);
var result = lines.Where(l => l.Contains("text")).ToList();
I hope this helps
I 've created 3 text box with input scope = "number " one for the day , one for the mounth and one for the year - I want to nd also verify that the input is corect , how can i do this ? Iimagine from c#...
first you can refer to the code of Microsoft.Phone.Controls.Toolkit 's DatePick
second if you just want to handle this in a easy way, + event of textChanged
and check your textbox 's value
I've been having this problem for a few days. Whenever I update a label in a StatusStrip object it formats my text backwards. I send my label something like
toolStripVoltage.Text = batteryVoltage.ToString("F2") + " V";
and the label will display V 2.82.
and when I send it something like
toolStripVoltage.Text = batteryVoltage.ToString("0.00 V");
it will display the same thing. It seems like no matter how I format the string the "V" goes before the numbers. and! it still puts a space in between the unit and the number. And here's the kicker: when I call this same text to appear in a tooltip of another object like this
toolStripVoltage.ToolTipText = toolStripVoltage.Text;
It displays as 2.82 V. Any ideas on how I can make this work for me?
EDIT:
oh wow. I instantly figured this out somehow...the default RightToLeft property is Yes. I don't know why that would be! but the trick was to set that to No. Very strange for that to be the default setting.