473,749 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using controls in user control as control parameters on parent page

HP
hi there

Is it possible to bind a datasource to a dropdownlist contained in a
user control if datasource is positioned on the parent page of user
control?
I guess not, since user control doesn't appear when I'm selecting
control parameters for datasource in a designer, right?
But what's the alternative? Should I create custom parameter (like
this: http://www.leftslipper.com/ShowFaq.aspx?FaqId=11) inside the
user control class?

thanks
HP

Dec 11 '06 #1
3 3619
HP
Hi,
Yes you can do it through properties.Supp ose in UserControl class you create
following property:

private DataSet x;
public DataSet SetDataSource
{
get
{
return x;
}
set
{
x = value;
}
}

In the parent page you can write following:

UserControlInst ance.SetDataSou rce = ds(a dataset variable)
Hope this has cleared your doubt.

Sorry, I forgot to mention, that I wanted to do it with declarative
DataBinding.

thanks
HP

Dec 12 '06 #2
Hi,
Yes you can do it.You can write following code in parent page:

DropDownList ctrldrp =(DropDownList)
UserControlInst ance.FindContro l("DropDownList Name")
ctrldrp.DataSou rce = ds( a dataset variable)

I think this is what you are looking for.

Thanks and Regards,
manish bafna

"HP" wrote:
Hi,
Yes you can do it through properties.Supp ose in UserControl class you create
following property:

private DataSet x;
public DataSet SetDataSource
{
get
{
return x;
}
set
{
x = value;
}
}

In the parent page you can write following:

UserControlInst ance.SetDataSou rce = ds(a dataset variable)
Hope this has cleared your doubt.


Sorry, I forgot to mention, that I wanted to do it with declarative
DataBinding.

thanks
HP

Dec 12 '06 #3
HP
Hi,
Yes you can do it.You can write following code in parent page:

DropDownList ctrldrp =(DropDownList)
UserControlInst ance.FindContro l("DropDownList Name")
ctrldrp.DataSou rce = ds( a dataset variable)
Yes, but I was thinking about declarative databinding (i.e. choosing
ddl as a source for select parameter of datasource control in the
visual studio designer).

thanks
HP

Dec 19 '06 #4

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

Similar topics

4
6729
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle from all the various explanations/answers. I'm attempting the typical scenario... I create a variable number of controls at runtime based on parameters from a database.
1
2577
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web page dynamically. To do this, First I including a web page (MainPage.aspx) and I made form tag to Runat=Server. I included one table tag and also made this table Runat=Server side. Second I created three Web User Controls e.g. wucCustomerInfo.ascx,
5
2420
by: mytestemailaccount | last post by:
Hi, Hope you can help. I am relatively new to all this but would appreciate the groups help. The scenario: I am c# and asp.net to create a web application. The web page contains a user control (.ascx).
1
2641
by: keith.walter | last post by:
My first asp.net app is almost "done" and I am stuck. Here is my situation: I have a "mother" page add_customer.aspx and a"child" user control add_group.ascx. On the mother page is an "add group" button that makes the the panel inwhich the add_customer control resides VISIBLE=True. On the control, the user can edit the list of groups, or add a new one. After the edit is complete I want to make the panel again VISIBLE=False, as well as...
4
1685
by: tshad | last post by:
Is there a way for a User Control to access an object (such as label or textbox) on the .aspx page that calls it? For example: x.aspx ************************************** .... Sub Page_Load(s as Object, e as EventArgs) LoadControl("x.ascx")
5
2341
by: tshad | last post by:
I have a PageInit.ascx that I want to put in all my pages and have it execute only once during the "not IsPostback" section. I also need it to execute first before anything else. I have it set as: <%@ Register TagPrefix="fts" TagName="pageInit" Src="/controls/pageInit.ascx" %> .... <body>
1
2101
by: Ramesh | last post by:
Hello all, I have a form in which I'm trying to load a user control depending on some user choice, and my control's events are not firing properly. Here's a completely stripped down repro of the problem: The form itself is empty: <body> <form id="form1" runat="server" /> </body>
53
4750
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code, and .Net2005 code. I'm developing in vb.net 2005. This test sub just reads an input text file, writing out records to another text file, eliminating records that have a '99' in them (it is similar to a CSV file). Some of my concerns are:
13
10722
by: tommymo | last post by:
Hi everyone I'm new to this site and the world of ASP.Net C# programming. I have been learning controls and integrating them with a SQL database. So far I have been able to move along and understand static controls. However I would like to move on to attempt to create some dynamic controls. So I set out to work with a radiobuttonlist questionnaire. I have a database and in that DB I have 2 tables one which holds the questions and the other...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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
9566
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
9388
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...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4608
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...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
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
3
2217
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.