I have designed a custom control and have been trying to set the TagPrefix and ToolBoxBitmap image to the control, but none of it is working!
Adding the TagPrefix to the control
To set the TagPrefix it's says to do this
'Within the AssemblyInfo.vb file add this
Imports System.Web.UI
'<Assembly: TagPrefix("Namespace Name", "TagPrefix")>
<Assembly: TagPrefix("JHAControls", "JHA")>
When I add my control to the page it shows up as this in the HTML
<%@dotnet.itags.org. Register TagPrefix="cc1" Namespace="JHACustomControls.JHAControls" Assembly="JHACustomControls" %>
the TagPrefix should be "JHA", not "cc1", which is the default.
Why doesn't this doesn't work!?
Adding an icon to the custom control
To add an icon to the custom control, it says to do this.
Assuming the icon is the same name as your class, which it is (JHATextBox class, and JHATextBox.bmp icon)
1) Create a 16x16 pixel bmp icon. which I did.
2) Add the icon to the project, which I did.
3) Set the icons build action to "Embedded Resource", which I did
4) Rebuild the project and the icon will display in the toolbox when the control is added.
This doesn't work either, I still get the default "gears" icon.
I can get the icon to work, but only if I specify the absolute path to the file (C:\MyFolder\MyFile.bmp). But then the control (.dll file) doesn't work on another computer unless the image exists in the same location on that computer.
Anyone know why these aren't working??I finally got the first part (TagPrefix) working...It isnt' only the namespace name that is needed...it is the SolutionName.Namespace name.
So instead of
<Assembly: TagPrefix("JHAControls", "JHA")>
it had to be
<Assembly: TagPrefix("JHACustomControls.JHAControls", "JHA")>
Where JHACustomControls is the name of the solution or project, then the namespace.
I still haven't figured out the icon part though.
I got it all fixed.
I removed the namespace from my class and the icon displayed just fine.
Thanks for the help!
What Help ?
I should be thanking you as you are miles ahead of me in .net.
I am finding it very difficult. Especially ADO.net.
I was being sarcastic, as it doesn't appear that anyone here has done, what I was trying to do.
.NET is pretty straight forward once you understand the basics.
If you need help just ask.
I have. I just haven't been around for a week. I have an entire toolbox tab full of controls with pretty icons. That tagPrefix is jumpy though it'll get lost and you'll have to mess with and force a full rebuild instead of the partial that is done default to fix it. And as best as I can tell you can only have one tagPrefix two even though the namespace is diffrent won't work.
Have you looked at designers yet. they are interesting to say the least.
Wednesday, March 28, 2012
They LIED!
Labels:
asp,
control,
custom,
designed,
image,
lied,
net,
tagprefix,
toolboxbitmap,
workingadding
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment