|
Use the InnerHtml property instead of InnerText .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
That didn't work, it's still encoded the br tag.
|
|
|
|
|
Then you did something wrong. What does the code look like?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Looks exactly the same as I posted earlier but I changed InnerText to InnerHTML. There should be a < and > surrounding the br tag, when I post that in here it actually puts a line break, but this is exactly what I have in my code. The Translate function just gets the string from my global resources file.
divResultsHeader.InnerHtml = Server.HtmlDecode(string.Format(Translate("resultsHeader"),
RoomNum.ToString(),
"br /",
infoObject.ReservationRoomInfoList[RoomNum-1].NumberAdults.ToString(),
infoObject.ReservationRoomInfoList[RoomNum-1].NumberChildren.ToString()));
|
|
|
|
|
You are obviously not seeing the result of that code. Check that you are actually watching the page where you change the code, and that the page is not cached.
I tried this code in code behind:
int RoomNum = 42;
int NumberAdults = 2;
int NumberChildren = 1;
divResultsHeader.InnerHtml = string.Format(
"Results for room {0}.{1}All shown rooms are suitable for {2} adults and {3} children",
RoomNum,
"<br/>",
NumberAdults,
NumberChildren);
The element in the page markup code looks like this:
<div id="divResultsHeader" runat="server"></div>
The resulting code in the page looks like this:
<div id="divResultsHeader">Results for room 42.<br/>All shown rooms are suitable for 2 adults and 1 children</div>
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You are right, during testing I was messing with encoding and decoding so I rewrote the div using an innertext. Thanks for your help.
|
|
|
|
|
Hi, Whatever i can do in vc++ can it also be done in c#, or is there any thing which is done in vc++ but not in c#???????
|
|
|
|
|
Well, C++ code can run without the .NET runtime, so that's one thing.
Why do you ask ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
i want to know which is more powerful c# or vc++. and is microsoft still supporting vc++ or vc++.net.
|
|
|
|
|
Well, this can be a bit subjective. VC++ was designed to extend the power of C++ with ready to use visual components(technically MFC and SDK).
That means, using VC++ you can do more low level programming compared to C#.
C# on the other hand is generally considered a better option for RAD(Rapid Application Development).
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have created one DataTable with 22 columns. I have filled all the appropiate values on DataTable.
Now i have one DataGridView in which added some of the 22 columns that i want to displayed in DGV.
Then how to bind appropiate column of DGV with same DataTable Columns.
|
|
|
|
|
DateTime? deathTime = null;
if(DateTime.TryParse("somedate",out deathTime))
else
The above shown code won't work as DateTime.TryParse accepts DateTime , not nullable DateTime . So how do we parse a nullable datetime ?
I made it working by the below code, don't know this is the correct approach.
DateTime tmpDateTime;
DateTime? deathTime = null;
if(DateTime.TryParse("somedate",out tmpDateTime))
deathTime = tmpDateTime;
else
Any ideas ?
|
|
|
|
|
Yes, that is the way that you have to do it. The out parameter can not be anything but a DateTime variable.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks Guffa.
I wonder, if they can introduce nullable DateTime , why don't they add an overload to TryParse which accepts nullable DateTime ?
|
|
|
|
|
Because every function everywhere would need an override that supports the nullable versions, which would get quite messy
|
|
|
|
|
N a v a n e e t h wrote: I wonder, if they can introduce nullable DateTime, why don't they add an overload to TryParse which accepts nullable DateTime ?
The TryParse method has no use for a nullable variable as out parameter, and it doesn't make sense to introduce something that isn't used.
It could have an overload without an out parameter, that returns a nullable value where a null value represents a failure to parse the string, but then you would have overloads with different semantics. That's not a good way to use overloading.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all,
I've an xml file formatted in C#. I want to rename it using the user define name without disturbing to the file content. How can I do it in C#. Can someone give me a solution for this.
Thanks a lot
I appreciate your help all the time...
CodingLover
modified on Monday, August 18, 2008 1:00 AM
|
|
|
|
|
Ok, I've solve the question my self. Simply use the File.Copy() function to do it.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Dear All,
I want to generate the highlighted code in C# by CodeDom. Now I am able to generate all the codes except the method invoke parameter, which is this one: "IdentityNo"
foreach (CCCRM.PatientRow dr in ta.GetAccessHusbandAndWife(IdentityNo))
{
}
The code that i am using to generate the above c# codes are:
webMethodDeclaration.Statements.Add(new CodeSnippetStatement("foreach (" + module + "." + parameter_1
+ " dr in ta." + methodInfo.Name + "("));
// Parameter list for Table Adapter Method
for (int i = 0; i < methodInfo.GetParameters().Length; i++)
{
string str1 = methodInfo.GetParameters()[i].Name;
webMethodDeclaration.Statements.Add(new CodeSnippetStatement(str1));
}
webMethodDeclaration.Statements.Add(new CodeSnippetStatement("))"));
but apparently they are not right. i was trying to use CodeMehtodInvokeExpression class, but it generates different souce code.
I do appreciate your help and thanks in advance.
Andie Du
|
|
|
|
|
I'm logging what thread my event handler is running on. My original log statement looks like this:
public void myEventHandler()
{
AnotherMethodWhereWorkIsDone(data);
System.Diagnostics.Debugger.Log(0,"", "Current thread is: " + Threading.CurrentThread.GetHashCode());
}
However, it occurs to me that this will actually report the thread that Debugger.Log is running on, and not that of my handler.
So then I snapshotted the CurrentThread.GetHashCode() at the top of my method.
public void myEventHandler()
{
int currHashCode = Threading.CurrentThread.GetHashCode();
AnotherMethodWhereWorkIsDone(data);
System.Diagnostics.Debugger.Log(0,"", "Current thread is: " + currHashCode);
}
But now it occurs to me that I have no idea if my method is guaranteed to be executing on the same thread all the way through. Is there some chance that after AnotherMethodWhereWorkIsDone() executes, my handler will be running on a different thread than when I shapshotted it above AnotherMethodWhereWorkIsDone() ?
|
|
|
|
|
Your assumptions are wrong. The compiler will turn this:
System.Diagnostics.Debugger.Log(0,"", "Current thread is: " + Threading.CurrentThread.GetHashCode());
into this:
int tempInt = Threading.CurrentThread.GetHashCode();
string tempStr = string.Concat("Current thread is: ", tempInt.ToString());
System.Diagnostics.Debugger.Log(0,"", tempStr);
JoeRip wrote: But now it occurs to me that I have no idea if my method is guaranteed to be executing on the same thread all the way through. Is there some chance that after AnotherMethodWhereWorkIsDone() executes, my handler will be running on a different thread than when I shapshotted it above AnotherMethodWhereWorkIsDone()?
Reply·Email·View Thread·PermaLink·Bookmark
No, that is not possible with plain old methods. (It is possible with yield return iterator methods, but that's another story.)
|
|
|
|
|
Thanks, the debugger.log answer does make sense.
For the other part: so my method is guaranteed to remain on the same thread from beginning to end of execution? Even if I called a method from inside it asynchronously (using delegate.BeginInvoke on its delegate)?
That makes me happy.
|
|
|
|
|
how can i play rmvb videos in panel control using c#.net?
i searched for help but couldn't find something.
thanks in advance.
|
|
|
|
|
I think I read somewhere that you can do this with DirectShow..I tried searching for my source but couldn't come up with it.
|
|
|
|
|
thanks swelborn but all i can do with DirectShow just play rm files (sound files) not rmvb files
|
|
|
|