Sunday, February 19, 2012

checking length of textbox value!

Hi

I was looking to check the length of a textbox then truncate it if it is graeter than some value and assign the that value for a textbox control in reporting service.How can i acheve this?

Thanks

This expression truncates any string in the textbox longer than 2 characters.

=Iif(Fields!FieldName.Value.ToString().Length() > 2, Fields!FieldName.Value.ToString().Substring(0,2), Fields!FieldName.Value)

You will need to change the field name to the actual field going into the textbox.

|||

I do not know who you are but I really would like to appreciate you !

Thanks a lot!

Ephi.

|||

I want to do the same thing as well as if the length of the field is shorted than the required length, I need to pad it with spaces. Can someone help with how to do that as well ?

Thanks

AY

No comments:

Post a Comment