Thanks for your followup Shawn,
Yes, I can understand your pain since make existing 3rd party controls to
be apdated to the new model will be rather more difficult than creating
custom one. Also, I've seen your another thread mentioned on the
Design-time support of the selecting datasource from the components list.
I'm afraid these limitation will remain as such behavior are all IDE
related , in fact design-time itself is just a IDE provided service. So
VS.NET 2005 has different service and interface than VS2003. And we can
still use VS.NET 2003 to develop asp.net 1.1 components/web application ,
deploy them side by side with VS 2005 developed 2.0 application. But to
move existing VS.NET 2003 developed controls directly adapted to the new
asp.net 2.0 model without touch the source, that's really difficult.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
--------------------
| Message-ID: <
[email protected]>
| From: Shawn Wildermuth <
[email protected]>
| Subject: RE: Problem writing a control with DataSource support...
| References: <
[email protected]>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Reader 671.6
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| Date: Mon, 03 Oct 2005 04:44:29 -0700
| NNTP-Posting-Host: c-24-30-14-34.hsd1.ga.comcast.net 24.30.14.34
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:11123
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hello Steven Cheng[MSFT],
|
| Several things are wrong with this:
|
| - DataBoundControlHelper is not a public class (this is obviously
reflected
| code, which is what I've based what I know from anyhow).
| - Your example doesn't help do the real job, getting the data from an
IDataSource.
| For some inane reason, ExecuteSelect is protected, but Select isn't. So
| in my code I call it asynchronously, but these seems far more tedious
than
| necessary. When I mentioned sync vs. async, I mean Select vs.
ExecuteSelect.
| It looks like the team is hiding (with Friend/Internal binding) far too
| much of the design-time and runtime support.
| - I understand what you say about the BaseDataBOundControlDesigner, but
the
| problem is that my control doesn't have a DataSourceID. I am trying to
map
| a new DataSourceID property to the DataSOUrce. Again, the underlying
control
| is a 3rd party component that I need to supply the data in the datasource
| both at runtime and designtime. (its a grid, and supplying data at
design
| time allows it to do things like retrieve the structure of the data to
automatically
| pre-populate a layout that my clients will change).
|
| I don't mean to sound as angry as I am likely to come off. I've been
battling
| this for over a month through Beta 2 and now RC and it hasn't gotten much
| better with the new release. If MS doesn't want me to do this, tell me
now
| so I can alert my client. It comes down to a period between release and
| 6-12 months when 3rd party components will unlikely have new versions
(infragistics
| aside). The change from the 1.x behavior to the 2.0 behavior is not
trivial
| and will take time. I would hope that microsoft would have had a
container
| that I could drop my 1.x controls in that would bridge between DataSource
| and DataSourceID by now, even if it were readonly.
|
| Thanks,
| Shawn Wildermuth
| Speaker, Author and C# MVP
|
| > Hi Shawn,
| >
| > Sorry for the inconvenience if didn't describe clearly or anything far
| > from
| > the one you expected. In my last reply what I mean is that at runtime,
| > the
| > DataBound control dosn't need any particular magic, for example, the
| > DropDownlist, it just use the following code to retreive the
| > datasource
| > through datasourceID:
| > ===============================
| > protected virtual IDataSource GetDataSource()
| > {
| > if ((!base.DesignMode && this._currentDataSourceValid) &&
| > (this._currentDataSource != null))
| > {
| > return this._currentDataSource;
| > }
| > IDataSource source1 = null;
| > string text1 = this.DataSourceID;
| > if (text1.Length != 0)
| > {
| > Control control1 =
| > DataBoundControlHelper.FindControl(this,
| > text1);
| > if (control1 == null)
| > {
| > object[] objArray1 = new object[2] { this.ID, text1
| > } ;
| > throw new
| > HttpException(SR.GetString("DataControl_DataSourceDoesntExist",
| > objArray1));
| > }
| > source1 = control1 as IDataSource;
| > if (source1 == null)
| > {
| > object[] objArray2 = new object[2] { this.ID, text1
| > } ;
| > throw new
| > HttpException(SR.GetString("DataControl_DataSourceIDMustBeDataControl"
| > ,
| > objArray2));
| > }
| > }
| > return source1;
| > }
| > ======================
| >
| > And we bind the retrieved source or related dataobjects to the control
| > as what we do in asp.net 1.x.
| >
| > For design-time, that'll be much more complex, since the Design-time
| > support for DataBound control in asp.net 2.0 introduce many new
| > design-time interfaces. Some are common with Winform control
| > developing, such as the Smart Tags here are some msdn reference on
| > this:
| >
| > #Simplify UI Development with Custom Designer Actions in Visual Studio
| >
http://msdn.microsoft.com/msdnmag/issues/05/07/DesignerActions/default
| > .aspx
| >
| > #How to: Use Services and Action Lists with Control Designers
| >
http://msdn2.microsoft.com/en-us/library/sey0f414(en-US,VS.80).aspx
| >
| > The Smart Tags(DesignerActionList can help provide richer design-time
| > task interactive) , we can provide the datasource configuration
| > through it just as most ASP.NET 2.0 controls do.
| >
| > For Communication between datasource control and the target databound
| > control, we also need to make our custom control's control designer
| > derived from the BaseDataBouncControlDesigner, below is the new
| > design-time support document in msdn:
| >
| > #ASP.NET Control Designers Overview
| >
http://msdn2.microsoft.com/en-us/library/wxh45wzs
| > Anyway, design-time related document is not quite sufficient, mostly
| > we would use the reflector tool to refernce some buildin control's
| > designer which may provide us more ideas or clues.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| > Get Secure!
www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | Message-ID: <
[email protected]>
| > | From: Shawn Wildermuth <
[email protected]>
| > | Subject: RE: Problem writing a control with DataSource support...
| > | References: <
[email protected]>
| > | MIME-Version: 1.0
| > | Content-Transfer-Encoding: 8bit
| > | Content-Type: text/plain; charset=iso-8859-1; format=flowed
| > | X-Newsreader: JetBrains Omea Reader 671.6
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | Date: Mon, 03 Oct 2005 01:01:41 -0700
| > | NNTP-Posting-Host: c-24-30-14-34.hsd1.ga.comcast.net 24.30.14.34
| > | Lines: 1
| > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:11118
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > |
| > | Hello Steven Cheng[MSFT],
| > |
| > | I hate to be blunt, but you don't seem to be answering questions,
| > but
| > just
| > | repeating what I say. Perhaps someone that uses English as a first
| > language?
| > |
| > | Thanks,
| > | Shawn Wildermuth
| > | Speaker, Author and C# MVP
| > |
| > | > Thanks for your response Shawn.
| > | >
| > | > What's the Async and sync you meaned? Data retrieving model? For
| > | > finding
| > | > the DataSource on the page, it is apparently that at runtime the
| > | > DataBound
| > | > controls will use the FindControl method to retrieve the
| > DataSource
| > | > Control
| > | > instance in the same NamingContainer. That means generally we
| > need to
| > | > put
| > | > the databound control and its data source control in the same
| > naming
| > | > container( this is ok most cases since we normally only use
| > drag-drop
| > | > for
| > | > GridView and datasource control at the page's top level rather
| > than in
| > | > some
| > | > sub control's inner content).
| > | > For design-time, I'll need to use another VS.NET IDE specific
| > | > design-time
| > | > programming model and api, just as what is supported in VS.NET2003
| > for
| > | > webcontrol's design-time development. Currently since the product
| > | > hasn't
| > | > been completely released, there haven't provide detailed reference
| > on
| > | > VS.NET 2005 design-time programming model, but surely that's
| > available
| > | > for
| > | > us to develop our own rich template databound control.
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | > Get Secure!
www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
| > no
| > | > rights.)
| > | > --------------------
| > | > | Message-ID: <
[email protected]>
| > | > | From: Shawn Wildermuth <
[email protected]>
| > | > | Subject: RE: Problem writing a control with DataSource
| > support...
| > | > | References: <
[email protected]>
| > | > | MIME-Version: 1.0
| > | > | Content-Transfer-Encoding: 8bit
| > | > | Content-Type: text/plain; charset=iso-8859-1; format=flowed
| > | > | X-Newsreader: JetBrains Omea Reader 671.6
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | Date: Fri, 30 Sep 2005 13:33:04 -0700
| > | > | NNTP-Posting-Host: dsl254-060-195.sea1.dsl.speakeasy.net
| > | > 216.254.60.195
| > | > | Lines: 1
| > | > | Path:
| > | > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols:11104
| > | > | X-Tomcat-NG:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > |
| > | > | Hello Steven Cheng[MSFT],
| > | > |
| > | > | Yes, I need to implement support for using controls that support
| > | > IDataSource.
| > | > | But the nature of how the Select stuff works (e.g. only async
| > is
| > | > supported
| > | > | externally, sync is supported for MS controls), and how the
| > magic of
| > | > finding
| > | > | data source controls on a page. Understand its is more than
| > just
| > | > supporting
| > | > | theDataSourceID, but also the design-time support for selecting
| > the
| > | > DataSourceID.
| > | > |
| > | > | Thanks,
| > | > | Shawn Wildermuth
| > | > | Speaker, Author and C# MVP
| > | > |
| > | > | > Hi Shawn,
| > | > | >
| > | > | > Welcome to ASPNET newsgroup.
| > | > | > From your description, you have an ASP.NET 1.X control(no
| > source
| > | > | > available)
| > | > | > which used to populate UI through databinding with datasource.
| > | > You're
| > | > | > currently wondering how to wrapper it so as to be adapted to
| > he
| > | > 2.0
| > | > | > DataSourceControls, yes?
| > | > | > If so, based on my understanding, the implementing of your
| > wrapper
| > | > | > control is not quite restricted or specific, the important
| > point
| > | > is
| > | > | > that your wapper control need to be adapetd to the DAtaSource
| > | > Controls
| > | > | > you need to support. As we can see all the ASP.NET 2.0
| > datasource
| > | > | > controls implementing the IDataSource interface, so I think
| > what
| > | > you
| > | > | > need to do is make your control be well defined for
| > interacting
| > | > with
| > | > | > the IDataSource interface. And do the data querying and
| > binding in
| > | > the
| > | > | > proper control 's serverside events. How do you think ?
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | > Get Secure!
www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
| > confers
| > | > no
| > | > | > rights.)
| > | > | > --------------------
| > | > | > | Message-ID:
| > <
[email protected]>
| > | > | > | From: Shawn Wildermuth <
[email protected]>
| > | > | > | Subject: Problem writing a control with DataSource
| > support...
| > | > | > | MIME-Version: 1.0
| > | > | > | Content-Transfer-Encoding: 8bit
| > | > | > | Content-Type: text/plain; charset=iso-8859-1; format=flowed
| > | > | > | X-Newsreader: JetBrains Omea Reader 671.6
| > | > | > | Newsgroups:
| > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > | Date: Thu, 29 Sep 2005 20:31:04 -0700
| > | > | > | NNTP-Posting-Host: dsl254-060-195.sea1.dsl.speakeasy.net
| > | > | > 216.254.60.195
| > | > | > | Lines: 1
| > | > | > | Path:
| > | > | >
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet.webcontrols:11087
| > | > | > | X-Tomcat-NG:
| > | > microsoft.public.dotnet.framework.aspnet.webcontrols
| > | > | > |
| > | > | > | I have a 1.x control (that I don't own the source to) and
| > need
| > | > to
| > | > | > expose
| > | > | > | it to my ASP.NET dev's to work with DataSources. At first I
| > | > tried to
| > | > | > inherit
| > | > | > | from DataBoundControl but because an issue with control
| > itself,
| > | > I
| > | > | > have to
| > | > | > | inherit from the 1.x control. Therefore I need to implement
| > | > | > everything
| > | > | > that
| > | > | > | the DataBoundControl does (especially design-time) in my
| > class.
| > | > | > Since
| > | > | > the
| > | > | > | DataBOundControl really isn't based on interfaces, but has
| > to
| > | > | > inherit
| > | > | > from
| > | > | > | it, I am finding this is nearly impossible. Much of
| > | > | > DataBoundControl
| > | > | > (and
| > | > | > | it's base class) is private or internal. I can re-implement
| > | > some of
| > | > | > it
| > | > | > using
| > | > | > | reflector to figure out what its doing, but this is such a
| > hack.
| > | > | > |
| > | > | > | So my question is, has anyone implemented a control that
| > support
| > | > | > DataSources
| > | > | > | without inheriting from DBC?
| > | > | > |
| > | > | > | Thanks,
| > | > | > | Shawn Wildermuth
| > | > | > | Speaker, Author and C# MVP
| > | > | > | |
| > | > | >
| > | > | |
| > | >
| > | |
| >
|
|