Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.††If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 31st, 2006, 09:45 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Composite Controls

Hi all.

I'm in the process of creating a composite control using C# and Visual Studio Prof 2005. The control takes an Image Url as one of its properties and this is defined in the component as:

//snippet of code

private String _FirstImageURL;

[
Category("Images"),
Description("The URL of the Image - e.g ~/images/first.gif"),
Browsable(true)
]
public String FirstImageURL
{
    get { return _FirstImageURL; }
    set { _FirstImageURL = value; }
}

//end code snippet

However, this doesn't give the desired effect when the component is being used in a project. Where the built in ASP:Image component has a button in the properties to allow the programmer to browse for the image within the current project, mine is just a normal text box.

I have tried many different ideas including changing the type from String to Image in the component code.

Does anyone have any ideas of how I can achieve this browsing option in the property of my component?

Thanks in advance,

Orig. :)

(p.s. please let me know if you need me to explain it better, I realise I might not be explaining this very well!)
Reply With Quote
  #2 (permalink)  
Old August 31st, 2006, 10:41 AM
Imar's Avatar
Wrox Author
Points: 67,815, Level: 100
Points: 67,815, Level: 100 Points: 67,815, Level: 100 Points: 67,815, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,295
Thanks: 66
Thanked 1,441 Times in 1,421 Posts
Default

Hi there,

Try adding an Editor attribute like this:
Code:
[EditorAttribute(typeof(System.Web.UI.Design.ImageUrlEditor), typeof(UITypeEditor))]
public string ImageUrl
{
    get
    {
        return imgUrl;
    }
    set
    {
        imgUrl= value;
    }
}
Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old August 31st, 2006, 10:58 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar.

Thankyou for your help, it worked perfectly,

Orig.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
AssociateControlID problem with Composite Controls ctt BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 May 12th, 2008 12:06 PM
PLEASE HELP - Composite Control brettk_1 ASP.NET 1.0 and 1.1 Professional 0 August 3rd, 2005 07:22 AM
Composite Control bmains .NET Framework 2.0 0 July 25th, 2005 01:57 PM



All times are GMT -4. The time now is 07:18 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.