Click here to Skip to main content
16,010,268 members
Home / Discussions / C#
   

C#

 
QuestionCircular dependency solution? Pin
Alex Korchemniy29-Mar-04 17:52
Alex Korchemniy29-Mar-04 17:52 
AnswerRe: Circular dependency solution? Pin
Heath Stewart29-Mar-04 18:29
protectorHeath Stewart29-Mar-04 18:29 
GeneralRe: Circular dependency solution? Pin
Alex Korchemniy30-Mar-04 6:06
Alex Korchemniy30-Mar-04 6:06 
GeneralRe: Circular dependency solution? Pin
Andy Wieberneit30-Mar-04 11:20
Andy Wieberneit30-Mar-04 11:20 
Generalwindows media player custom control Pin
Marveyles29-Mar-04 17:00
Marveyles29-Mar-04 17:00 
GeneralRe: windows media player custom control Pin
Heath Stewart29-Mar-04 18:23
protectorHeath Stewart29-Mar-04 18:23 
GeneralRe: windows media player custom control Pin
Marveyles29-Mar-04 18:39
Marveyles29-Mar-04 18:39 
GeneralRe: windows media player custom control Pin
Heath Stewart29-Mar-04 18:45
protectorHeath Stewart29-Mar-04 18:45 
You don't understand simple object-oriented development? Think, for example, of Console.WriteLine. Does it ask you what to print, or do you tell it? The latter of course.

Your WMP control should have the Url property set by the container control (like the Page or other container), just like they set the Text property of a Label or the NavigateUrl or a HyperLink control either in the HTML declaration of your control, or programmatically. NEVER request a property from a page like that, which wouldn't work properly anyway without a reference to the page itself (and a cast in order to get a field defined in your class, not the Page or other container control's class).

It's a simple difference between callers and callees. Just look at all the other server controls declared in your page. Are they asking your page for data, or does your page provide the data to them. Again, the latter case is true. Your control should act no differently, such that in your .aspx you might find:
<uc1:wmp id="wmp1" runat="server" url="/path/to/file.wmv" />
ASP.NET uses the url proeprty to set your Url property in your class, and when the Render method is called by ASP.NET your code will get the value of that property. At no point does this code request a variable from some page.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: windows media player custom control Pin
Marveyles29-Mar-04 19:05
Marveyles29-Mar-04 19:05 
GeneralTransparent Images on Transparent Forms Pin
authenticgeek29-Mar-04 15:38
authenticgeek29-Mar-04 15:38 
GeneralRe: Transparent Images on Transparent Forms Pin
Andy Brummer29-Mar-04 16:04
sitebuilderAndy Brummer29-Mar-04 16:04 
GeneralRe: Transparent Images on Transparent Forms Pin
authenticgeek29-Mar-04 16:33
authenticgeek29-Mar-04 16:33 
GeneralRe: Transparent Images on Transparent Forms Pin
Heath Stewart29-Mar-04 19:53
protectorHeath Stewart29-Mar-04 19:53 
GeneralRe: Transparent Images on Transparent Forms Pin
authenticgeek30-Mar-04 7:07
authenticgeek30-Mar-04 7:07 
GeneralDataGrid and FlexGrid Pin
«_Superman_»29-Mar-04 15:21
professional«_Superman_»29-Mar-04 15:21 
GeneralRe: DataGrid and FlexGrid Pin
Heath Stewart29-Mar-04 18:16
protectorHeath Stewart29-Mar-04 18:16 
GeneralRe: DataGrid and FlexGrid Pin
«_Superman_»1-Apr-04 14:53
professional«_Superman_»1-Apr-04 14:53 
GeneralRe: DataGrid and FlexGrid Pin
Heath Stewart2-Apr-04 9:05
protectorHeath Stewart2-Apr-04 9:05 
GeneralQuestion on drag-n'-drop and files vs folders Pin
Flack29-Mar-04 14:47
Flack29-Mar-04 14:47 
GeneralRe: Question on drag-n'-drop and files vs folders Pin
Heath Stewart29-Mar-04 18:09
protectorHeath Stewart29-Mar-04 18:09 
GeneralRe: Question on drag-n'-drop and files vs folders Pin
Flack30-Mar-04 4:47
Flack30-Mar-04 4:47 
GeneralRe: Question on drag-n'-drop and files vs folders Pin
Heath Stewart30-Mar-04 4:54
protectorHeath Stewart30-Mar-04 4:54 
Generalusing static Pin
pgraeve29-Mar-04 12:45
pgraeve29-Mar-04 12:45 
GeneralRe: using static Pin
Christian Graus29-Mar-04 13:18
protectorChristian Graus29-Mar-04 13:18 
GeneralRe: using static Pin
Heath Stewart29-Mar-04 18:00
protectorHeath Stewart29-Mar-04 18:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.