CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: Date Entered: 10/19/2003 3:28:19 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 5 Views: 104 Favorited: 0 Favorite
6 Items, 1 Pages 1 |< << Go >> >|
"digiduck" <>
NewsGroup User
Passing data to parent control.10/19/2003 3:28:19 PM

0

On a page I have a usercontrol (uc1) and in uc1 I have another usercontrol (uc2). uc2 needs to pass data to a property of uc1. How can I do this? I tried the following but it said 'The specified cast is not valid'.


Dim p as Zword.UC1 = me.Parent 'line that drew error.
p.MyProperty = whatever


Thanks for your help.

Gone looing for myself. Should I return before I'm back, keep me here.
"hlaford" <>
NewsGroup User
Re: Passing data to parent control.10/19/2003 5:30:31 PM

0

how about exposing the data as a property of uc2 that the parent control (uc1) can query? i don't think the child control ought to be assuming that it's part of a particular parent type, whereas the parent will always know what it's children are.
"digiduck" <>
NewsGroup User
Re: Passing data to parent control.10/19/2003 6:04:15 PM

0

I tried that already but it didn't work for me because i needed to access the data in the onLoad event of uc1 but the onLoad event of uc1 would always run before the uc2 control had been able to process its events.
Gone looing for myself. Should I return before I'm back, keep me here.
"joteke" <>
NewsGroup User
Re: Passing data to parent control.10/19/2003 6:22:07 PM

0

Just a quick shot, but could it help that the parent control would have a public event that it raises when it is "ready" to take the data. The child control consumes this event and provides data for the parent control in this case (when the event is raised).

EDIT: Or better thinking what if opposite i.e child control has processed its events and then it provides the data for the parent (do you have control over both controls?)
Thanks,

Teemu Keiski
Finland, EU
"digiduck" <>
NewsGroup User
Re: Passing data to parent control.10/19/2003 6:26:36 PM

0

Do you have any examples you could provide? and what do you mean be "control over both conrols?"
Gone looing for myself. Should I return before I'm back, keep me here.
"joteke" <>
NewsGroup User
Re: Passing data to parent control.10/19/2003 6:51:58 PM

0

I mean that are both custom controls developed by you so that you can change their behaviour. Raising ("publishing") an event and subscribing to it is pretty trivial task. In the simplest scenario something like this:

On the publishing control have a public member that represents the event say:

Public Event <Eventname> As EventHandler


In the publishing control when you want to raise the event call:

RaiseEvent <EventName>(Me,EventArgs.Empty)


(EventArgs empty is the empty event arguments when there's no need to pass anything custom event arguments).

The subscribing control just needs have typed reference (in VS.NET type of the code-behind class) to the control publishing the event so that it can wire up an event handler method. Say:

Dim publisher As <type>=CType(FindControl("publisherID"),<type>)
AddHandler publisher.<EventName>,AddressOf <event handler method name>


where <event handler method name> is the handler that is called when event <EventName> is raised on publishing control. It can then do what it needs to do by the logic. The method signature just needs to match the delegate type (EventHandler) of the event.

Note that the previous code to look for the subscriber would be valid when event is exposed by the child control. If event is exposed by the parent control, you need to reference it via the Parent property that you cast or say call Page.FindControl and then cast etc.


Thanks,

Teemu Keiski
Finland, EU
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:













capturing directory contents of a shared network folder

how to use the web.conf file

database structure problem

remote debugging on a lan with visual studio .net 2003?

ie hangs on back button, sometimes...

can't keep a value on vewstate

file upload and permissions

objects and containment

using findbyvalue (c#)

new to .net

display source code with line number in vs style

session exception

am i missing something?

asp in asp.net

literal control vs. label control

learning asp.net

iis7 vista vs2005 mozilla problem

how do i do dynamic search criteria in asp.net

unable to send mail

dynamic zip file being created but not being populated

i've few questions, so patient :)

instant messenger

override automatic javascript ?

please help basic questions

name does not exist in the current context

how can we avoid being bombarded on our internet facing app?

pass value from usercontrol to another usercontrol

refresh my memory on terms

radiobuton in gridview

unicode string display

any real world examples for using remoting?

repeater

control suggestion

httpcontext.current.cache

files on the server

copying files on the server

secure a hyperlink querystring

catching soapexception in global.asax -> application_error

how to search

sub page_unload

input string on update function

page doesnt refresh

user control and relative/absolute links

last modified dates and file size

code snippet manager

best way to achieve browser independence (newbie question)

accessing word in asp.net

new to asp.net

calling a variable

control reference question

   
  Privacy | Contact Us
All Times Are GMT