Thursday, September 29, 2011

Input field -get value

problem

It is not possible in asp.net to get value in server side without runat=server tag but the problem solved



Solution

It’s simple: Request.Form returns NameValueCollection. GetValues is a NameValueCollection class method which gives us the requested result.
Request.Form.GetValues(”txtSomeText”) returns a string array with all the values.




Operator ===



Have you ever used the strict equal operator? I learned about it few days ago…
Below is a quick explanation of its behavior:

"The strict equal to operator returns true if both operands are equal (and of the same type). It doesn't perform any data type conversion, so an expression like 1 === true returns false and 1 === "1" also returns false, because this operator checks for the type of the operands. 1 is a numerical value and “1″ is a string value; their types are different."

Hid Div and white spaces it occupy




Pic the div by there ID and hide it through Jquery or javascript .I m here just doing with it by javascript.


Problem


Most of the developers will say “I can use javascript and CSS ‘visibility’ property to do that”, but shortly after that they’ll realize that this is not enough. This solution will hide the div tag content, but the space it occupies will stay.

You can reproduce this behavior using the code below:

if (objDiv.style.visibility == 'visible' ||
objDiv.style.visibility == '')
{
objDiv.style.visibility = 'hidden';
}
else
{
objDiv.style.visibility = 'visible';
}
where objDiv is the div object which you’re trying to hide.

Solution

It’s simple - initialize “display” property in addition. So the above code will look like:

if (objDiv.style.visibility == 'visible' ||
objDiv.style.visibility == '')
{
objDiv.style.visibility = 'hidden';
objDiv.style.display = 'none';
}
else
{
objDiv.style.visibility = 'visible';
objDiv.style.display = 'block';
}
css, div, hide, javascript white space

No comments:

Post a Comment