By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,931 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,931 IT Pros & Developers. It's quick & easy.

interim values from custom control

P: n/a
I have a custom server control which renders some html.

I want to capture some interim values generated by the control as it processes the data.

is there a way to capture and retrieve the interim values generated by the control, so they can be used elsewhere in the display
page ?

Mar 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Raise an event in your user control, have anyone who cares to hook into the
event and retrieve the event argument.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
I have a custom server control which renders some html.

I want to capture some interim values generated by the control as it
processes the data.

is there a way to capture and retrieve the interim values generated by the
control, so they can be used elsewhere in the display page ?


Mar 14 '06 #2

P: n/a
not sure how to get an event raised for my situation.

the primary use of the custom control is achieved with :

"<cc1:myCustomControl id="CustomControl1" runat="server" />"

properties are assigned programatically with a call to "LoadProperties(CustomControl1)"

Sub LoadProperties(oThis)
othis.Chart_align = "center"
...
End Sub
and this part works.
then my weak attempt to get an interim arraylist back from the custom control

.............. code start ...

'create a new instance of control
'-----------------------------------
Dim oDisplay as myCustomControl = New myCustomControl
call LoadProperties(oDisplay )

'create new arraylist
'--------------------------
Dim myArrayList As New ArrayList()

'populate arraylist
'-----------------------
myArrayList = oDisplay.buildarraylist()

............. end code .....

This fails because it's not accepting the properties, but it does accept them on the first instance above ??

------------- error msg -----------------
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 1415: writer.AddAttribute("align", Chart_align.ToString() )


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
Raise an event in your user control, have anyone who cares to hook into the event and retrieve the event argument.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message news:Oc**************@TK2MSFTNGP14.phx.gbl...
I have a custom server control which renders some html.

I want to capture some interim values generated by the control as it processes the data.

is there a way to capture and retrieve the interim values generated by the control, so they can be used elsewhere in the display
page ?



Mar 14 '06 #3

P: n/a
you need to define an event in your control, ala:

public event ValueChanged() as CommandEventHandler

have a function that raises it

private sub RaiseValueChanged(newValue as string)
dim args as new CommandEventArgs("ValueChanged", newValue)
RaiseEvent ValueChanged(args)
end sub
you can then hook into the event on the page..

AddHandler othis.ValueChanged, AddressOf(SomeFunction)
sub SomeFunction(source as object, e as CommandEventArgs)
dim newValue as string = e.CommandArgument
end sub
not sure if all that vb.net is right...should give you some ideas...

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
not sure how to get an event raised for my situation.

the primary use of the custom control is achieved with :

"<cc1:myCustomControl id="CustomControl1" runat="server" />"

properties are assigned programatically with a call to
"LoadProperties(CustomControl1)"

Sub LoadProperties(oThis)
othis.Chart_align = "center"
...
End Sub
and this part works.
then my weak attempt to get an interim arraylist back from the custom
control

............. code start ...

'create a new instance of control
'-----------------------------------
Dim oDisplay as myCustomControl = New myCustomControl
call LoadProperties(oDisplay )

'create new arraylist
'--------------------------
Dim myArrayList As New ArrayList()

'populate arraylist
'-----------------------
myArrayList = oDisplay.buildarraylist()

............ end code .....

This fails because it's not accepting the properties, but it does accept
them on the first instance above ??

------------- error msg -----------------
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 1415: writer.AddAttribute("align",
Chart_align.ToString() )


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:ud**************@TK2MSFTNGP10.phx.gbl...
Raise an event in your user control, have anyone who cares to hook into
the event and retrieve the event argument.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
I have a custom server control which renders some html.

I want to capture some interim values generated by the control as it
processes the data.

is there a way to capture and retrieve the interim values generated by
the control, so they can be used elsewhere in the display page ?




Mar 14 '06 #4

P: n/a
thanks for trying to help me.

I must be very thick, or I must be stating my question all wrong, because this doesn't seem applicable. I can't see any way to
implement this.

I'll try to rethink/restate my problem and do another posting.

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
news:O8*************@TK2MSFTNGP12.phx.gbl...
you need to define an event in your control, ala:

public event ValueChanged() as CommandEventHandler

have a function that raises it

private sub RaiseValueChanged(newValue as string)
dim args as new CommandEventArgs("ValueChanged", newValue)
RaiseEvent ValueChanged(args)
end sub
you can then hook into the event on the page..

AddHandler othis.ValueChanged, AddressOf(SomeFunction)
sub SomeFunction(source as object, e as CommandEventArgs)
dim newValue as string = e.CommandArgument
end sub
not sure if all that vb.net is right...should give you some ideas...

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message news:eb**************@TK2MSFTNGP12.phx.gbl...
not sure how to get an event raised for my situation.

the primary use of the custom control is achieved with :

"<cc1:myCustomControl id="CustomControl1" runat="server" />"

properties are assigned programatically with a call to "LoadProperties(CustomControl1)"

Sub LoadProperties(oThis)
othis.Chart_align = "center"
...
End Sub
and this part works.
then my weak attempt to get an interim arraylist back from the custom control

............. code start ...

'create a new instance of control
'-----------------------------------
Dim oDisplay as myCustomControl = New myCustomControl
call LoadProperties(oDisplay )

'create new arraylist
'--------------------------
Dim myArrayList As New ArrayList()

'populate arraylist
'-----------------------
myArrayList = oDisplay.buildarraylist()

............ end code .....

This fails because it's not accepting the properties, but it does accept them on the first instance above ??

------------- error msg -----------------
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 1415: writer.AddAttribute("align", Chart_align.ToString() )


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
Raise an event in your user control, have anyone who cares to hook into the event and retrieve the event argument.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Jon Paal" <Jon[ nospam ]Paal @ everywhere dot com> wrote in message news:Oc**************@TK2MSFTNGP14.phx.gbl...
I have a custom server control which renders some html.

I want to capture some interim values generated by the control as it processes the data.

is there a way to capture and retrieve the interim values generated by the control, so they can be used elsewhere in the
display page ?




Mar 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.