Property is not setting in custom control property

hi ,

        I am adding an image control programmatically in a webpartzone which is adding successfully but the properties i am setting in image control are not setting .following is the code that i am using .the code 'img.ImageUrl = "~/images/atlas_title.jpg"     do not set the property in it.

Dim webmgr As WebPartManager = WebPartManager.GetCurrentWebPartManager(Me)

Dim img As New Web.UI.WebControls.Image

img.ID = "Img"

'img.ImageUrl = "~/images/atlas_title.jpg"           

Dim wpart As GenericWebPart = webmgr.CreateWebPart(img)

Dim wimg As WebPart = webmgr.AddWebPart(wpart, WebPartZone1, 1)




9/4/2006 11:30:58 AM 3779 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 33
Get it on Google Play
Get it on Apple App Store

i find the same question,but i have not find the solution.waiting someone help us!
9/12/2006 1:17:48 PM

i get it!


You can access it if you use the GenericWebParts's ChildControl Property, and cast the returned control to your user control.

You can also create your own custom control and inherits the WebPart class, if you do so, you don't need to "turn" the control into a Generic webpart.

for example: 

  ((Image)WebPartManager1.WebParts[0].Controls[0]).ImageUrl = "";

9/13/2006 4:59:51 PM

Similar Artilces:

How do I make a Custom Property in my Custom Control into a Bindable Property
I've got a custom control in ASP.NET 2.0.  I want to bind one of its properties to data, but even though I specify the [ Bindable(true) ], before the property, the only property that shows up in the Data Bindings dialog is "visible". This is my code for the Custom Control:public partial class Offers_SearchTemplates_OfferSearchButton : System.Web.UI.UserControl{[Bindable(true)]public virtual string OfferUID{get{object objTitle = ViewState["OfferUID"];if (objTitle == null)return string.Empty;return (string)objTitle;}set{ViewState["OfferUID"] = value;...

Custom controls with properties exposed in Dropdown or like Microsoft control properties
I need to create a custom control. For this control I want to expose some properties which I want to set from a XML/ from a Enum class. I want user to select the appropriate property from the dropdown to configure the control. (i.e. like we set AllowSorting property for Gridview and user can select just true or false from drop down)  So could anybody please help me finding a sample for such custom control? Hi There, Below is a simplae example of custom control which allow you to pick property via enum and booleancontrol: public partial class Sample_Control_WebUserControl2 : ...

How do I set the value of a custom property of a custom control in code-behind?
Perhaps I'm going about this the wrong way entirely, and I'm actually asking the wrong question... so here's what I would like to do: I have CustomControlB embedded in CustomControlA... CustomControlB has a custom property of "PublisherID" which I have created like this: private string _publisherid;public string PublisherID{     get     {          return _publisherid;     }     set     {     &nbs...

setting user control property from the properties window
I have a public string property in the my user control that i want to be visible in the properties window when i add the user control to another page. i know that i have to use something like [Browsable ... etc] but it's not working for me. i've read many articles and posts but it's not making any sense. im doing this but it's not appearing in the properties window: private string title; [Browsable(true)] public string Title { get { return title;} set { title = value;} } I want to be able to set title from the properties window, what else do i need to do? ...

Adding a property to a user control, setting property at design time, then using value in control markup
 I have made a custom control that outputs a bunch of html. I have added a property through the code behind like this:  private string sectionID; public string SectionID { get { return sectionID; } set { sectionID = value; } } This property is now showing up in Intellisense, and I can specify the value when adding the control to my page like this: <ccl:MyControl runat="server" SectionID="2" /> I now want to use this value in the markup that the control outputs. I thi...

set custom control property
Hello. I hope someone can help with this. I've no idea if the techniques that I am using are correct, but I cannot seem to read the property i am trying to set in my custom control. Here is a broken down version of my class with the relevant parts: Public Class clients : Inherits UserControl    Public ddlClients As DropDownList    Dim strValidate As String    Public ReadOnly Property validate() As String       Get          Return strValidate     ...

How to create custom properties for aspx page which should refelect in design time properties window itself.( as like as custom server control).
Hi. I need to create the custom properties for aspx page itself where those custom properties should refelet in the properties window at the design time as like as other custom server controls. I tried pageBase class which will have cusom properties for page and inherited that pageBase to my aspx page . But its refelecting the code  behind file not in design time. I need to accss those aspx page custom properties at the design time itself in properties window as like as other custom server control.I appriciate your help. [FYI: my scenerio is customer ...

Custom UI Control losing information of nested controls upon Set of some its properties
 Hi there, I have created a custom web control, aptly name MyLinkButton. The ascx looks like this:<asp:LinkButton ID="lnkLinkButton" runat="server" OnClick="lnkLinkButton_Click" OnCommand="lnkLinkButton_Command">    <span>        <asp:Literal ID="ltlLinkText" runat="server" />    </span></asp:LinkButton> When you set any of it's properties, it internally sets the property of the lnkLinkButton control with the exception o...

Setting properties of a Custom Web Control
Hi, I am making a web control which includes multiple controls. I am setting the properties of individual controls. I am facing problem with the "Font" property. I am not able to set multiple styles - Bold, Italic & Underline. Either I am able to set the Bold or Italic or Underline property. I am not able to set any 2 of them simultaneously... If I set two styles then I get the following error: Object reference not set to an instance of an object. Please help me with this. Thanks & Regards, Bans Ok, what I can gather, you have a composi...

web custom control properties
I have this Image button control that I render.  I made a property for the image source file that comes up in the properties menu of the visual designer.I'm trying to get that little icon to appear that lets the user navigate to the image file source.  You must use the Editor annotation.[Editor(typeof(System.Drawing.Design.ImageEditor), typeof(System.Drawing.Design.UITypeEditor))]public string ImageUrl{    get{...}    set{...} } Make sure to add reference to System.Drawing and System.Drawing.Design I need to do it vb, forgot to mention it....

Setting custom properties of a dynamic control
Hi,I'm trying to find a way to set a custom property of a user control that i'm loading into a placeholder. I can easily do this if I know in advance what kind of control it is, like in this example I'm loading an HTMLContent user control:int _pid = 93;string _file = "HTMLContent.ascx";Control tmpControl = Page.LoadControl("Controls/" + _file);((HTMLContent)tmpControl).PageID = _pid;plcHolder.Controls.Add(tmpControl);This works fine, but I don't know what type of control I'm going to be loading here, so the PageID property cannot be found. Does anyone have a way to get this don...

Using VS CssClass Property Editor for custom control CssClass property
I am developing a custom composite control, which includes a Title and a Description label (among other things) I want to allow the user to define the CSS Class names for the control's components using specific properties, such as TitleCssClass, DescriptionCssClass.  At design time, I would like to provide the same editing experience offered by VS for the control CssClass, i.e. a dropdown list enumerating the available styles in the solution. How can I do that? I thought I could use some custom property attributes, to tell VS that a given control's property is in ...

Set up property editors for a custom server control
I built a custom web server control which has a FormView property. When I drop the control on a web form, the FormView property is visible in the designer. Its value shows 'None' and the dropdownlist for this property is empty. The dropdownlist should contain all FormView controls which are on the web form. How can I fill the dropdownlist in the designer with all FormView controls? Now I cannot edit the property with anything, although the FormView property has a setter. Should I mark the property with some kind of attribute? Nils GrusonMicrosoft .NET Consultant (MCPD)LogicaYou don&#...

When can i access a set property of a custom control?
I call the control on the page and it works fine. ie: <kas:btn val1="someValue" id="sp" runat="server" Text="Click Here" /> I am setting a public property called val1 which I can access in the onClick event in the controls logic, but nowhere else??? I'm trying to use this value to dynamically set an Attribute of the control (ie: this.Attributes.Add("onClick", script + val1). However, I am trying to get that value when the constructor is run:(I have also tried in the PreRender, OnIit, etc.) so in the constructor, say I ...

Web resources about - Property is not setting in custom control property -

Property - Wikipedia, the free encyclopedia
This article may require copy editing for grammar, style, cohesion, tone, or spelling . You can assist by editing it . In abstract, property ...

Property - Wikipedia, the free encyclopedia
In abstraction, property is that which belongs to or with something, whether as an attribute or as a component of said thing. For the significant ...

Facebook's Mark Zuckerberg faces trial over Silicon Valley property deal
... broke a promise to introduce him to Silicon Valley's elite. Facebook boss Mark Zuckerberg is headed toward a trial after all as the property ...

Canberra's rental yields on the rise, despite sluggish property market
Canberra has experienced the lowest annual shift in rental prices in Australia over the past decade.

Mount Isa Police crackdown nets 20 people over property theft - The Courier-Mail Search Search
ABOUT 20 people have been charged, including 17 juveniles, after a series of break and enters and thefts in Mount Isa.

Masters faces property upheaval
Woolworths could pay heavily to break leases across its hardware portfolio.

Accused Rabobank trader reportedly sells Mandurah property for half price
A former Rabobank trader facing possible extradition to the US has sold a Mandurah&nbsp;property for less than half its purchase price, it has ...

Spiking property assessments may leave thousands without Home Owner Grant
A spike in property assessments in Metro Vancouver means thousands no longer qualify for the Home Owner Grant, unless the provincial government ...

Digital property after death issues continue as Apple requires court order for widow to get late husband’s ...
... , iOS Check out 9to5Mac for more breaking coverage of AAPL Company , iOS Devices , and Apps . What do you think? Discuss "Digital property ...

Prestige property leads house price falls
Sydney property prices fell for the second consecutive month and the top end fell fastest, dropping 2.3 per cent in December, the CoreLogic RP ...

Resources last updated: 1/20/2016 7:14:17 PM