Null character ('\0') causes problems with updatepanel
I have, an odd problem. I receive data from many different applications within our company and display this data on a website. The data itself may have some odd characters within the string depending on the system that sent the data. My problem is I have a table that users can search through to allow that has this data in i开发者_如何转开发t, if I try and put this table within an updatepanel the program throws javascript exceptions. The specific error that I receive is:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
I have traced this error down to the fact that some of the information contains null characters in it. For example a record may be "\0\0 MESSAGE : \0\0" I can parse the null characters out, however my boss says this is not an acceptable solution. My question is, is there anyway to keep the update panel from throwing exceptions without manipulating the data?
You can try this and i hope it will solve your problem
string str = null;
if (string.IsNullOrWhiteSpace(str))
{
Response.Write("value is null");
}
This IsNullOrWhiteSpace function returns true or false value, so you can check this before assigning null value to a variable.....
精彩评论