Monday, March 12, 2012

What is the datatype returned by a controls width property?

Hello,

What is the data type returned from an asp.net control's Width property?

I tried performing arithematic operations on it but asp.net(vb) recognised it as a syntax error.

private int test

label1.width = Me.width * (test/100) 'vb highlighted this as an error

How do we perform arithematic on the width properties? :confused:Width is an Integer data type, When you perform this calculation it returns a double so you should convert it to Integer using this code label1.width = Convert.ToInt32(Me.width * (test/100) )
As far I know Width is a Unit type not an Integer Type. Value of Width is an Integer Type.

So, for asp.net the correct code will be

label1.width = Convert.ToInt32(Me.width.Value * (test/100) )

Rajib

0 comments:

Post a Comment