views:

1458

answers:

4

Hi, I'm using Ultrawebgrid for my applcation:

I'm using a textarea for listing the errors in my application in the row template when the user clicks that particular row...

So I need to have texarea when there are any errors..... otherwise when there are no errors i dont even want the row_template to pop up..... I'm using IE6.

I'm checking if there are any errors using javascript.so I had to use the javascript event handler:: *UltraWebGrid1_BeforeRowTemplateOpenHandler(gridName, rowId, templateId)*

where in I write the statements given below: document.getElementById("TextArea2").style.visibility="collapse" inside the above event function

1) it's showing javascript error as "Couldnot get the visibility property:Invalid Argument" but the row template does not pop up....... only the error's coming....

2) Is there any code to block the row template when there are no errors.?? i mean no pop_up for no errors

What's the solution for this???

+3  A: 

Try using:

document.getElementById("TextArea2").style.display = 'none';

and (to turn it back on again)

document.getElementById("TextArea2").style.display = 'block'; // or 'inline'
tvanfosson
Textarea is an inline element. So no need to use display block.
rahul
If I were displaying error messages I wouldn't want it to display inline. Of course, I'd probably display in them in a DIV or SPAN, too.
tvanfosson
I'd have done it with class modification to separate CSS and JS concerns, but I'd def go with block for the reasons above
annakata
+1  A: 

You want:

document.getElementById("TextArea2").style.visibility = "hidden";

"collapse" is not a valid value for the visibility property in IE6, as your error message indicates.

Alternatively as suggested by @tvanoffsen you could set the display property to "none". This has a slightly different effect - it will not take up any space if set to "display: none", whereas setting "visibility: hidden" still takes up space.

Greg
@Greg -- I was anticipating the next question -- how do I get rid of the blank space where the textarea was? :-)
tvanfosson
Collapse is a valid value ( http://www.w3.org/TR/CSS2/visufx.html#visibility ) but (it would appear) unsupported in IE6.
David Dorward
Hmm interesting... edited
Greg
+3  A: 

DISPLAY

Use display instead of visibility. This occupies no space in your document.

document.getElementById("TextArea2").style.display = 'none';    // Turn off    
document.getElementById("TextArea2").style.display = 'inline';  // Turn on

VISIBILITY

document.getElementById("TextArea2").style.visibility="hidden";    // Turn off
document.getElementById("TextArea2").style.visibility="visible";    // Turn on

By using the above code textarea won't be visible, but there will be blank space in your document having the height and width of the textarea.

Also 'collapse' value is supported only in Internet Explorer 8

rahul
A: 

use visible and hidden for .style.visibility attribute not block and hidden. it works.

Shans