473,796 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Custom Control

I am building a web custom control that encapsulates a
series of dropdowns, buttons, etc. It is derived from a
WebControl. I have the control built so that it renders
properly. Now I am defining the public Bind() method so
that I can connect to various datasources via a
connection property I have defined.

The problem is that in my public Bind() method when I am
populating a dropdown using Datasource and DataBind, the
dropdown is not populated. I have the dropdown
(ddlbProduct) defined at the class level where I am
creating a new instance of the dropdown:

DropDownList ddlbProduct= new DropDownList();

I am placing it on my control in the CreateChildCont rols
() override like this:

thePageView.Con trols.Add(ddlbP roduct); // I'm putting the
dropdown inside of a PageView

I am binding the dropdown to a DataTable in my public Bind
() function like this:

ddlbProduct.Dat aSource = theDataSet.Tabl es[0];
ddlbProduct.Dat aValueField = "product_li ne";
ddlbProduct.Dat aTextField = "product_line_n ame";
ddlbProduct.Dat aBind();

When I step it through in debug I can see the instance of
ddlbProduct get populated correctly on the
ddlbProduct.Dat aBind() call. The instance that is
rendered on the page is not populated though. The only
time I am implicitly instantiating it is at the class
level.

I know this is probably an easy one. This is my first
custom control.

Thanks,

Steve
Nov 17 '05 #1
5 1243
In your public Bind() method you have to go private. This is not suitable to
be done publicly. It should only be done behind closed doors by consenting
adults.
"Steve R" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I am building a web custom control that encapsulates a
series of dropdowns, buttons, etc. It is derived from a
WebControl. I have the control built so that it renders
properly. Now I am defining the public Bind() method so
that I can connect to various datasources via a
connection property I have defined.

The problem is that in my public Bind() method when I am
populating a dropdown using Datasource and DataBind, the
dropdown is not populated. I have the dropdown
(ddlbProduct) defined at the class level where I am
creating a new instance of the dropdown:

DropDownList ddlbProduct= new DropDownList();

I am placing it on my control in the CreateChildCont rols
() override like this:

thePageView.Con trols.Add(ddlbP roduct); // I'm putting the
dropdown inside of a PageView

I am binding the dropdown to a DataTable in my public Bind
() function like this:

ddlbProduct.Dat aSource = theDataSet.Tabl es[0];
ddlbProduct.Dat aValueField = "product_li ne";
ddlbProduct.Dat aTextField = "product_line_n ame";
ddlbProduct.Dat aBind();

When I step it through in debug I can see the instance of
ddlbProduct get populated correctly on the
ddlbProduct.Dat aBind() call. The instance that is
rendered on the page is not populated though. The only
time I am implicitly instantiating it is at the class
level.

I know this is probably an easy one. This is my first
custom control.

Thanks,

Steve

Nov 17 '05 #2
I changed it so that I am calling a private method from
my public Bind() method. Still doesn't work.

I need a public method to do the bind so that I can set
the connection property first.
-----Original Message-----
In your public Bind() method you have to go private. This is not suitable tobe done publicly. It should only be done behind closed doors by consentingadults.


Nov 17 '05 #3
This is definitely too racey for me. Someone mark this thread XXX please.
"Steve R" <an*******@disc ussions.microso ft.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
I changed it so that I am calling a private method from
my public Bind() method. Still doesn't work.

I need a public method to do the bind so that I can set
the connection property first.
-----Original Message-----
In your public Bind() method you have to go private.

This is not suitable to
be done publicly. It should only be done behind closed

doors by consenting
adults.

Nov 17 '05 #4
So you were just BS'ing me on your original reply?
-----Original Message-----
This is definitely too racey for me. Someone mark this thread XXX please.


Nov 17 '05 #5
Does anyone else have any advice?

Thanks,

Steve
-----Original Message-----
I am building a web custom control that encapsulates a
series of dropdowns, buttons, etc. It is derived from a
WebControl. I have the control built so that it renders
properly. Now I am defining the public Bind() method so
that I can connect to various datasources via a
connection property I have defined.

The problem is that in my public Bind() method when I am
populating a dropdown using Datasource and DataBind, the
dropdown is not populated. I have the dropdown
(ddlbProduct ) defined at the class level where I am
creating a new instance of the dropdown:

DropDownList ddlbProduct= new DropDownList();

I am placing it on my control in the CreateChildCont rols
() override like this:

thePageView.Co ntrols.Add(ddlb Product); // I'm putting thedropdown inside of a PageView

I am binding the dropdown to a DataTable in my public Bind() function like this:

ddlbProduct.Da taSource = theDataSet.Tabl es[0];
ddlbProduct.Da taValueField = "product_li ne";
ddlbProduct.Da taTextField = "product_line_n ame";
ddlbProduct.Da taBind();

When I step it through in debug I can see the instance ofddlbProduct get populated correctly on the
ddlbProduct.Da taBind() call. The instance that is
rendered on the page is not populated though. The only
time I am implicitly instantiating it is at the class
level.

I know this is probably an easy one. This is my first
custom control.

Thanks,

Steve
.

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2440
by: Christian H | last post by:
Hi! I've created a custom control (myDrawControl) that deals with drawing. This control is then added to a form( myMainForm) Now, whenever something is dragged and dropped onto myDrawControl , I want to update a variable in myMainForm that keeps track of the objects that have been added.(ArrayList objectsAdded) Now I'm a little confused... How can I do this, when the method that deals
15
10949
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works great. But I now want to show a different tooltip for every day. For now I found out that I can add a tooltip for the entire custom control
21
2105
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value Terry,Burns.
1
1869
by: Wannabe_Geek | last post by:
Hi Iam new to MS .Net technology just getting along with it....I created a custom control ,which takes in a query and displays the data in a tabular format....something similar to a datagrid. Since its a custom Control I drag and drop and use it in my Pages. I overload the render method of my Custom Control and I pass the data that is to be displayed. Now there is a requisite I have to add a Control ( Say for ex a Dropdown List box)...
7
3020
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
2597
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
4
1774
by: Smokey Grindle | last post by:
What is the best way to write dynamic controls in ASP.NET 2.0?
11
18151
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
15
6523
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
5
4130
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container> <asp:textbox />
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.