Hi,
I'm using the WebDataTree and having a problem with the way it is initially rendering. What happens after a pageload and the end user gets the response, the main wrapper/div of the control, has a default style that includes visibility=visible.. I cannot have this since it will be hidden on page load (Even if the tree control is inside a hidden div, it will still be visible)
I have not found an easy way where I can take of that visibility=visible.. I don't see it in the defaultstyles css files, and when I say webdatatree.style["visibility"] = ""; or webdatatree.style["visibility"] = "hidden"; it still returns visibility=true..
Is there a way I can solve this without useing the sourcecode or doing something onPreRender ?
Please help
im still unable to find a way... I tried working with the Render event and noticed after a while that there is a javascript function inside a resource file called by the client somewhere on clientside pageload or something...
///<summary>
/// The WebDataTree class is used to represent the object model of a the WebDataTree ASP.Net Server control.
///</summary>
$IG.WebDataTree =
function(element){$IG.WebDataTree.initializeBase(this, [element]);element.style.visibility = "visible";this._bindings = this._getPropertyBindings();
why????????? how can this be stopped
you can attach to the client side Initialize event. Then you can use the sender which represents the WebDataTree control object and say: sender.get_element().style.visibility = "";
sender.get_element() will return the main DIV element of the control.
Hope this helps.
Thanks,
Lubomir
Neat, I tried what you said above and it works. Below is an example for anyone who happens to come across this.. The only thing is that if I want it hidden by default on initial load, it will flash visible on the client browser and then it will invoke the ClientInit function i have below. If you don't want the flash you will probably have to alter the resource file.. This will do, thanks!
MARKUP:<ig:WebDataTree ID="tvMSelect" runat="server" CheckBoxMode="TriState" ClientEvents-Initialize="TreeVisibility"></ig:WebDataTree>
CODE - BEHIND:StringBuilder sb = new StringBuilder(); sb.AppendLine();sb.AppendLine(@"function TreeVisibility(sender)");sb.AppendLine(@"{");sb.AppendLine(@" sender.get_element().style.visibility = """";");sb.AppendLine(@"}");if (ScriptManager.GetCurrent(this.ContainerPage).IsInAsyncPostBack){ ScriptManager.RegisterClientScriptBlock(this.ContainerPage, typeof(string), "TreeVisibility", sb.ToString(), true); }else { this.ContainerPage.ClientScript.RegisterClientScriptBlock(typeof(string), "TreeVisibility", sb.ToString(), true); }
Hey Lubomir,
Thanks for the response. This option looks very good and the way to go.. Unfortunatly, I spent the time yesterday and updated the resource file so it just says style.visibility = ""..
There are so many properties/functions that it is easy to overlook.
Anyways, I will try your answer.. I'm sure it'll do the job.
Thank you