Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

IE WebControls in Custom WebPart

  Asked By: Armando    Date: Feb 18    Category: Sharepoint    Views: 1205

Is it possible to include the IE WebControls (specifically the TreeView) server
controls in a custom webpart? I built the controls with a strong name that I
generated, and added the new dll to the webpart library references. I copied
the dll into the GAC, but whenever I try to render the TreeView I end up with a
page cannot be found error in my browser. I believe it starts to load the page
and then tries to redirect/transfer me somewhere that is not working.

I am presuming that if the IE Webcontrols were not trusted I would get an error
stating such.

Here is an example of my code:
protected override void RenderWebPart(HtmlTextWriter output)
tree = new Microsoft.Web.UI.WebControls.TreeView();
TreeNode dummyNode = new TreeNode();
dummyNode.Text = "My Tree View";
TreeNode rootNode = new TreeNode();
rootNode.Text = "Node 1";



4 Answers Found

Answer #1    Answered By: Tanner Moss     Answered On: Feb 18

I've seen others talking about their use of these controls  in a Web
Part. Watch out for the hard coded \inetpub\wwwroot\ references  in the
default code. I suspect that therein lies the problem...

Here's one thread I read recently:

Answer #2    Answered By: Bobby Boyd     Answered On: Feb 18

Can you just tell me how you have created a strongname key for IE
webcontrol. as it is a 3rd party tool we could not generate a
strongname keys.

Answer #3    Answered By: Sean Perez     Answered On: Feb 18

That is mostly correct. The source does not have an AssemblyInfo.cs file, the file you need to update is Version.cs
You can just add the strong name information at the end  of the file as such:
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile(@"c:\keypair001.snk")]
[assembly: AssemblyKeyName("")]

Then just run your build.bat the same way you would have before.

found  why I got redirected to a Page Not Found (404) page - Todd was also correct on this... There is a hard code  to go to the root of the website and the webctrl_client folder.. I forgot to add this as an exclusion in the virtual server managed paths, and thus the control could not find the client side behaviors. Once I added  that, it all worked. (I did not have to add a safe controls  section to web.config as someone else mentioned because I put the dll  in the GAC as we'll be using the controls with multiple applications.)

The controls are unsupported. However, from what I've seen, the next version of ASP.Net will have a very similar control built  right in. The controls have also been very stable for us in other production asp.net applications.

Answer #4    Answered By: Moises Harrington     Answered On: Feb 18

This is not a forum for help with the IE WebControls. You may find more
complete answers in this newsgroup:

That said, I have used the IE WebControl treeview  control. Although I
don't think that there is a hard coded limit, I don't think that loading
more than 1000 nodes  onto any treeview is ever wise, especially on a Web
page. I would expect issues.

Perhaps you could use what I call: dynamic data disclosure. Populate the
top-level nodes and only populate the immediate child nodes of the nodes
that people choose.

Didn't find what you were looking for? Find more on IE WebControls in Custom WebPart Or get search suggestion and latest updates.