|
 |
aspx thread: Dynamically creating LiteralControls in a custom WebControl.
Message #1 by kevin.burton@i... on Tue, 28 Nov 2000 13:29:00 -0600
|
|
I am trying to build a custom control that essentially is a TreeView of my
data. I have been able to build a control that uses Render... and builds a
tree of child controls in CreateChildControls. These two methods work just
fine. Now I want to dynamically build the tree. When I click on a node if
the content for the node has not been retrieved I want to retrieve it and
build the content otherwise I want to just expand or contract the list. The
expanding and contracting I will do by changing the classid of the list
along with a .CSS file. To build a the content for a node I need to
intercept a 'click' event and insert the content. My question is how do I
intercept a 'click' event and process it on the server? And how do I figure
out what item I clicked on and modify the LiteralControl tree structure to
include the new information?
Any suggestions would be greatly appreaciated.
Kevin Burton
kevin.burton@i...
Message #2 by Joe Jones <joejo@m...> on Wed, 29 Nov 2000 08:46:27 -0800
|
|
You have to implement IPostBackEventHandler in your Control.
There is a sample that shows how to do this. If you've installed the
samples, you can see the examples at:
http://localhost/quickstart/util/srcview.aspx?Path=/quickstart/aspplus/samples/webforms/ctrlauth/noncomposition/NonComposition2.src&
file=NonComposition2.cs
(Watch out for wrapped URLs)
Joe
> -----Original Message-----
> From: kevin.burton@i... [mailto:kevin.burton@i...]
> Sent: Tuesday, November 28, 2000 11:29 AM
> To: ASP+
> Subject: [aspx] Dynamically creating LiteralControls in a
> custom WebControl.
>
>
> I am trying to build a custom control that essentially is a
> TreeView of my data. I have been able to build a control that
> uses Render... and builds a tree of child controls in
> CreateChildControls. These two methods work just fine. Now I
> want to dynamically build the tree. When I click on a node if
> the content for the node has not been retrieved I want to
> retrieve it and build the content otherwise I want to just
> expand or contract the list. The expanding and contracting I
> will do by changing the classid of the list along with a .CSS
> file. To build a the content for a node I need to intercept a
> 'click' event and insert the content. My question is how do I
> intercept a 'click' event and process it on the server? And
> how do I figure out what item I clicked on and modify the
> LiteralControl tree structure to include the new information?
>
> Any suggestions would be greatly appreaciated.
>
> Kevin Burton
> kevin.burton@i...
>
>
Message #3 by kevin.burton@i... on Wed, 29 Nov 2000 11:45:26 -0600
|
|
Thank you, I had missed this example. This will be very helpfull.
Now, what information is available to me about the object or control that
was clicked on? I don't quite understand the use of LoadPostData and the
arguments passed in to that function. Is what I want to do is to modify the
class name of one of the literal controls so that its children will be
hidden or exposed. I also want to modify the image to reflect a collapsed or
expanded list. So I need to a) know which control in the array of controls
that I have created that was clicked on, b) modify the contents of the
control and/or insert a new array of controls (if this node has not been
expanded before).
Any ideas?
Kevin Burton
kevin.burton@i...
-----Original Message-----
From: Joe Jones [mailto:joejo@m...]
Sent: Wednesday, November 29, 2000 10:46 AM
To: ASP+
Subject: [aspx] RE: Dynamically creating LiteralControls in a custom
WebCo ntrol.
You have to implement IPostBackEventHandler in your Control.
There is a sample that shows how to do this. If you've installed the
samples, you can see the examples at:
http://localhost/quickstart/util/srcview.aspx?Path=/quickstart/aspplus/sampl
es/webforms/ctrlauth/noncomposition/NonComposition2.src&file=NonComposition2
.cs
(Watch out for wrapped URLs)
Joe
> -----Original Message-----
> From: kevin.burton@i... [mailto:kevin.burton@i...]
> Sent: Tuesday, November 28, 2000 11:29 AM
> To: ASP+
> Subject: [aspx] Dynamically creating LiteralControls in a
> custom WebControl.
>
>
> I am trying to build a custom control that essentially is a
> TreeView of my data. I have been able to build a control that
> uses Render... and builds a tree of child controls in
> CreateChildControls. These two methods work just fine. Now I
> want to dynamically build the tree. When I click on a node if
> the content for the node has not been retrieved I want to
> retrieve it and build the content otherwise I want to just
> expand or contract the list. The expanding and contracting I
> will do by changing the classid of the list along with a .CSS
> file. To build a the content for a node I need to intercept a
> 'click' event and insert the content. My question is how do I
> intercept a 'click' event and process it on the server? And
> how do I figure out what item I clicked on and modify the
> LiteralControl tree structure to include the new information?
>
> Any suggestions would be greatly appreaciated.
>
> Kevin Burton
> kevin.burton@i...
>
>
Message #4 by Joe Jones <joejo@m...> on Wed, 29 Nov 2000 11:09:03 -0800
|
|
The only information you get is the string parameter you pass to
GetPostBackEventReference as the second param. I usually encode what ever
info I need into this string,and then decode it in the RaisePostBackEvent
event handler.
Joe
> -----Original Message-----
> From: kevin.burton@i... [mailto:kevin.burton@i...]
> Sent: Wednesday, November 29, 2000 9:45 AM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom W ebControl.
>
>
> Thank you, I had missed this example. This will be very helpfull.
>
> Now, what information is available to me about the object or
> control that was clicked on? I don't quite understand the use
> of LoadPostData and the arguments passed in to that function.
> Is what I want to do is to modify the class name of one of
> the literal controls so that its children will be hidden or
> exposed. I also want to modify the image to reflect a
> collapsed or expanded list. So I need to a) know which
> control in the array of controls that I have created that was
> clicked on, b) modify the contents of the control and/or
> insert a new array of controls (if this node has not been
> expanded before).
>
> Any ideas?
>
> Kevin Burton
> kevin.burton@i...
>
>
> -----Original Message-----
> From: Joe Jones [mailto:joejo@m...]
> Sent: Wednesday, November 29, 2000 10:46 AM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom WebCo ntrol.
>
>
> You have to implement IPostBackEventHandler in your Control.
>
> There is a sample that shows how to do this. If you've
> installed the samples, you can see the examples at:
>
> http://localhost/quickstart/util/srcview.aspx?Path=/quickstart
> /aspplus/sampl
> es/webforms/ctrlauth/noncomposition/NonComposition2.src&file=N
> onComposition2
> .cs
>
> (Watch out for wrapped URLs)
>
> Joe
>
> > -----Original Message-----
> > From: kevin.burton@i... [mailto:kevin.burton@i...]
> > Sent: Tuesday, November 28, 2000 11:29 AM
> > To: ASP+
> > Subject: [aspx] Dynamically creating LiteralControls in a
> > custom WebControl.
> >
> >
> > I am trying to build a custom control that essentially is a
> > TreeView of my data. I have been able to build a control that
> > uses Render... and builds a tree of child controls in
> > CreateChildControls. These two methods work just fine. Now I
> > want to dynamically build the tree. When I click on a node if
> > the content for the node has not been retrieved I want to
> > retrieve it and build the content otherwise I want to just
> > expand or contract the list. The expanding and contracting I
> > will do by changing the classid of the list along with a .CSS
> > file. To build a the content for a node I need to intercept a
> > 'click' event and insert the content. My question is how do I
> > intercept a 'click' event and process it on the server? And
> > how do I figure out what item I clicked on and modify the
> > LiteralControl tree structure to include the new information?
> >
> > Any suggestions would be greatly appreaciated.
> >
> > Kevin Burton
> > kevin.burton@i...
> >
> >
>
Message #5 by kevin.burton@i... on Wed, 29 Nov 2000 17:59:02 -0600
|
|
I the RasePostBackEvent can I search the 'Controls' collection for a
particular item by name? If I can do that then how do I change that item?
I have implemented a LoadPostData (right now I just return false) and I set
a break point there and I notice that it never gets called. Should it be
called. I put the NonComposition2.cs/.aspx files into the debugger and I
notice that the
LoadPostData routine is getting called. What determines whether this is
called or not?
Thanks again.
Kevin Burton
kevin.burton@i...
-----Original Message-----
From: Joe Jones [mailto:joejo@m...]
Sent: Wednesday, November 29, 2000 1:09 PM
To: ASP+
Subject: [aspx] RE: Dynamically creating LiteralControls in a custom W
ebControl.
The only information you get is the string parameter you pass to
GetPostBackEventReference as the second param. I usually encode what ever
info I need into this string,and then decode it in the RaisePostBackEvent
event handler.
Joe
> -----Original Message-----
> From: kevin.burton@i... [mailto:kevin.burton@i...]
> Sent: Wednesday, November 29, 2000 9:45 AM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom W ebControl.
>
>
> Thank you, I had missed this example. This will be very helpfull.
>
> Now, what information is available to me about the object or
> control that was clicked on? I don't quite understand the use
> of LoadPostData and the arguments passed in to that function.
> Is what I want to do is to modify the class name of one of
> the literal controls so that its children will be hidden or
> exposed. I also want to modify the image to reflect a
> collapsed or expanded list. So I need to a) know which
> control in the array of controls that I have created that was
> clicked on, b) modify the contents of the control and/or
> insert a new array of controls (if this node has not been
> expanded before).
>
> Any ideas?
>
> Kevin Burton
> kevin.burton@i...
>
>
> -----Original Message-----
> From: Joe Jones [mailto:joejo@m...]
> Sent: Wednesday, November 29, 2000 10:46 AM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom WebCo ntrol.
>
>
> You have to implement IPostBackEventHandler in your Control.
>
> There is a sample that shows how to do this. If you've
> installed the samples, you can see the examples at:
>
> http://localhost/quickstart/util/srcview.aspx?Path=/quickstart
> /aspplus/sampl
> es/webforms/ctrlauth/noncomposition/NonComposition2.src&file=N
> onComposition2
> .cs
>
> (Watch out for wrapped URLs)
>
> Joe
>
> > -----Original Message-----
> > From: kevin.burton@i... [mailto:kevin.burton@i...]
> > Sent: Tuesday, November 28, 2000 11:29 AM
> > To: ASP+
> > Subject: [aspx] Dynamically creating LiteralControls in a
> > custom WebControl.
> >
> >
> > I am trying to build a custom control that essentially is a
> > TreeView of my data. I have been able to build a control that
> > uses Render... and builds a tree of child controls in
> > CreateChildControls. These two methods work just fine. Now I
> > want to dynamically build the tree. When I click on a node if
> > the content for the node has not been retrieved I want to
> > retrieve it and build the content otherwise I want to just
> > expand or contract the list. The expanding and contracting I
> > will do by changing the classid of the list along with a .CSS
> > file. To build a the content for a node I need to intercept a
> > 'click' event and insert the content. My question is how do I
> > intercept a 'click' event and process it on the server? And
> > how do I figure out what item I clicked on and modify the
> > LiteralControl tree structure to include the new information?
> >
> > Any suggestions would be greatly appreaciated.
> >
> > Kevin Burton
> > kevin.burton@i...
> >
> >
>
Message #6 by Joe Jones <joejo@m...> on Thu, 30 Nov 2000 08:54:01 -0800
|
|
Not that I am aware of, since the controls collection seems to be just an
array. If you need to index the collection, you might want to store the
ordinal value in your post back string parameter.
Joe
> -----Original Message-----
> From: kevin.burton@i... [mailto:kevin.burton@i...]
> Sent: Wednesday, November 29, 2000 3:59 PM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom W ebControl.
>
>
> I the RasePostBackEvent can I search the 'Controls'
> collection for a particular item by name? If I can do that
> then how do I change that item?
>
> I have implemented a LoadPostData (right now I just return
> false) and I set a break point there and I notice that it
> never gets called. Should it be called. I put the
> NonComposition2.cs/.aspx files into the debugger and I notice
> that the
> LoadPostData routine is getting called. What determines
> whether this is called or not?
>
> Thanks again.
>
> Kevin Burton
> kevin.burton@i...
>
>
> -----Original Message-----
> From: Joe Jones [mailto:joejo@m...]
> Sent: Wednesday, November 29, 2000 1:09 PM
> To: ASP+
> Subject: [aspx] RE: Dynamically creating LiteralControls in a
> custom W ebControl.
>
>
> The only information you get is the string parameter you pass
> to GetPostBackEventReference as the second param. I usually
> encode what ever info I need into this string,and then decode
> it in the RaisePostBackEvent event handler.
>
> Joe
>
> > -----Original Message-----
> > From: kevin.burton@i... [mailto:kevin.burton@i...]
> > Sent: Wednesday, November 29, 2000 9:45 AM
> > To: ASP+
> > Subject: [aspx] RE: Dynamically creating LiteralControls in a
> > custom W ebControl.
> >
> >
> > Thank you, I had missed this example. This will be very helpfull.
> >
> > Now, what information is available to me about the object or
> > control that was clicked on? I don't quite understand the use
> > of LoadPostData and the arguments passed in to that function.
> > Is what I want to do is to modify the class name of one of
> > the literal controls so that its children will be hidden or
> > exposed. I also want to modify the image to reflect a
> > collapsed or expanded list. So I need to a) know which
> > control in the array of controls that I have created that was
> > clicked on, b) modify the contents of the control and/or
> > insert a new array of controls (if this node has not been
> > expanded before).
> >
> > Any ideas?
> >
> > Kevin Burton
> > kevin.burton@i...
> >
> >
> > -----Original Message-----
> > From: Joe Jones [mailto:joejo@m...]
> > Sent: Wednesday, November 29, 2000 10:46 AM
> > To: ASP+
> > Subject: [aspx] RE: Dynamically creating LiteralControls in a
> > custom WebCo ntrol.
> >
> >
> > You have to implement IPostBackEventHandler in your Control.
> >
> > There is a sample that shows how to do this. If you've
> > installed the samples, you can see the examples at:
> >
> > http://localhost/quickstart/util/srcview.aspx?Path=/quickstart
> > /aspplus/sampl
> > es/webforms/ctrlauth/noncomposition/NonComposition2.src&file=N
> > onComposition2
> > .cs
> >
> > (Watch out for wrapped URLs)
> >
> > Joe
> >
> > > -----Original Message-----
> > > From: kevin.burton@i...
> [mailto:kevin.burton@i...]
> > > Sent: Tuesday,
> November 28, 2000 11:29 AM
> > > To: ASP+
> > > Subject: [aspx] Dynamically creating LiteralControls in a custom
> > > WebControl.
> > >
> > >
> > > I am trying to build a custom control that essentially is
> a TreeView
> > > of my data. I have been able to build a control that uses
> Render...
> > > and builds a tree of child controls in CreateChildControls. These
> > > two methods work just fine. Now I want to dynamically build the
> > > tree. When I click on a node if the content for the node has not
> > > been retrieved I want to retrieve it and build the
> content otherwise
> > > I want to just expand or contract the list. The expanding and
> > > contracting I will do by changing the classid of the list
> along with
> > > a .CSS file. To build a the content for a node I need to
> intercept a
> > > 'click' event and insert the content. My question is how do I
> > > intercept a 'click' event and process it on the server?
> And how do I
> > > figure out what item I clicked on and modify the
> LiteralControl tree
> > > structure to include the new information?
> > >
> > > Any suggestions would be greatly appreaciated.
> > >
> > > Kevin Burton
> > > kevin.burton@i...
> > >
> > >
> >
>
|
|
 |