Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > using controls in user control as control parameters on parent page

Reply
Thread Tools

using controls in user control as control parameters on parent page

 
 
HP
Guest
Posts: n/a
 
      12-11-2006
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

 
Reply With Quote
 
 
 
 
HP
Guest
Posts: n/a
 
      12-12-2006
> Hi,
> Yes you can do it through properties.Suppose 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:
>
> UserControlInstance.SetDataSource = 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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNoIEJhZm5h?=
Guest
Posts: n/a
 
      12-12-2006
Hi,
Yes you can do it.You can write following code in parent page:

DropDownList ctrldrp =(DropDownList)
UserControlInstance.FindControl("DropDownListName" )
ctrldrp.DataSource = 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.Suppose 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:
> >
> > UserControlInstance.SetDataSource = 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
>
>

 
Reply With Quote
 
HP
Guest
Posts: n/a
 
      12-19-2006
> Hi,
> Yes you can do it.You can write following code in parent page:
>
> DropDownList ctrldrp =(DropDownList)
> UserControlInstance.FindControl("DropDownListName" )
> ctrldrp.DataSource = 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
Access User Control DataGrid Controls from parent page =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 1 02-16-2005 04:44 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Building Controls 1 01-04-2005 04:09 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Web Controls 1 01-04-2005 04:09 PM



Advertisments