Development Experience

Wednesday, September 17, 2014

Eval and String split usage

Today I was having trouble to split data item in grid like this post.

Problem is Split Method wants an argument which is char and the syntax of asp.net doesn't allow you to use together double quotation mark "" and single one which is this ' '.

Eval("Total Cost").ToString().Split(Convert.ToChar('.'))[0]  // gives you an error but

Eval("Total Cost").ToString().Split(Convert.ToChar("."))[0] // works well

good luck...

No comments:

Post a Comment