CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 2/18/2004 4:46:37 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 8 Views: 17 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
9 Items, 1 Pages 1 |< << Go >> >|
dlongieliere
Asp.Net User
Composite control question...2/18/2004 4:46:37 PM

0/0

Im developing a web application and i wanted to make it easily expandable by including a dynamic inclusion of composite controls at run time based on data coming off the sql server in thier profile.

however, when attempting to create a composite control that lets say, would display a message from a director, it works. but if i want to have that same control handle if the director is the person viewing it, add a button to create a new message, change the control to a textbox, and a submit button, it works. the problem is, that im getting no handler on the second post back to the submit button.

does this make sense?
sedgewick
Asp.Net User
Re: Composite control question...2/18/2004 5:01:47 PM

0/0

Step through and what do you see?

All the controls have to be added to the control tree again

so lets say you have 7 controls that are added programatically

They don't handle their events until they've been added again

Maybe post some code before I really screw things up
Get ready to blast your energy levels into high gear with Sedgewick Energy Drink. High powered adaptogenic herbs mixed with potent levels of B-vitamins and...

Please disregard the contents of this post.
dlongieliere
Asp.Net User
Re: Composite control question...2/18/2004 5:14:23 PM

0/0

This basically recreates the problem im having. I realize that this isnt how to do it properly, as its not working, just not finding any real support for this type or problem, atleast not in vb.net...

basically i just want to make steps first one, calls teh second, second calls the third, third loops to begining again....

any thoughts?

Namespace test
Public Class component
Inherits Control
Implements INamingContainer

Public Sub sub1(ByVal sender As Object, ByVal e As EventArgs)
'Me.Controls.Clear()

Dim btn As New Button
btn.Text = "Click here to call the second sub"
Me.Controls.Add(btn)
AddHandler btn.Click, AddressOf sub2

End Sub
Public Sub sub2(ByVal sender As Object, ByVal e As EventArgs)
Me.Controls.Clear()
Page.Response.Write("This is the end point.")
Dim btn As New Button
btn.Text = "click here to call the start point again"
Me.Controls.Add(btn)

End Sub

Protected Overrides Sub CreateChildControls()
Dim lbl As New Label
lbl.Text = "Start Point"
Me.Controls.Add(lbl)

Dim btn As New Button
btn.Text = "click here to call first sub"
Me.Controls.Add(btn)
AddHandler btn.Click, AddressOf sub1



End Sub


End Class
End Namespace
sedgewick
Asp.Net User
Re: Composite control question...2/18/2004 8:34:09 PM

0/0

oh I see

you know, the handler is only added when the button is clicked.

so this will never work, see what I mean?

You'd have to click the first button to get the second button and handler added, but on post back it will never get recreated unless you always click button 1!

So what you will want to do is have a variable - in a public property - it is a boolean that you set to true in button 1 click event

and in your createchildControls, thats where you will create all your buttons.

If you want to have unlimited buttons, then make your property an arrayList or hashtable
Get ready to blast your energy levels into high gear with Sedgewick Energy Drink. High powered adaptogenic herbs mixed with potent levels of B-vitamins and...

Please disregard the contents of this post.
dlongieliere
Asp.Net User
Re: Composite control question...2/18/2004 8:37:39 PM

0/0

mind whipping me up a quick example of what you mean? pseudo is fine.
sedgewick
Asp.Net User
Re: Composite control question...2/18/2004 9:18:45 PM

0/0

I haven't coded much in vb for 2 years so this is probably screwed up


private _buttons as ArrayList

public property Buttons as ArrayList
get return _buttons


set _buttons = value
' is that how a property looks in VB?

end property

'.... inside create child controls
foreach string s in Buttons ' this is supposed to be a foreach loop
dim button as new Button
button.Text = s
button.Command += ' a command event thinger here
button.CommandArgument = s
button.Click += ' and you could use this one instead
me.Controls.Add(button)
end foreach


I guess because your creating unknown number of buttons, its better to use Command event rather than click, I don't know.

in your click event (or command if you want ot use that one) you would add a string to the arrayList, but because createchild controls has already been called, you have to add it to the controls collection still... or I guess you could
me.Controls.clear()
and then call CreateChildControls

You know, maybe I should code this out in vb

in your click
Get ready to blast your energy levels into high gear with Sedgewick Energy Drink. High powered adaptogenic herbs mixed with potent levels of B-vitamins and...

Please disregard the contents of this post.
master4eva
Asp.Net User
Re: Composite control question...2/19/2004 1:49:55 PM

0/0

The error was that you were adding the reference to the delegated methods for the events after the control was added to the control tree. This is the error:

Me.Controls.Add(btn)
AddHandler btn.Click, AddressOf sub1

It should have been:

AddHandler btn.Click, AddressOf sub1
Me.Controls.Add(btn)

-- Justin Lovell
dlongieliere
Asp.Net User
Re: Composite control question...2/19/2004 3:36:26 PM

0/0

yeah ive tried it both ways, without any luck
master4eva
Asp.Net User
Re: Composite control question...2/20/2004 1:37:08 PM

0/0

There is also one thing that I forgot to mention. The button that causes the post back must be present in the page control hierarchy must be there during post back.
-- Justin Lovell
9 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET AJAX Programming Tricks Authors: Matthew David Ellis, Matthew Ellis, Pages: 388, Published: 2007
Comparing the Work Attitudes of Women and Men Authors: Judith Buber Agassi, Pages: 336, Published: 1982
MCAD Developing and Implementing Web Applications with Microsoft Visual C#(TM) . NET and Microsoft Visual Studio(R) . NET Exam Cram 2 (Exam Cram 70-315): Exam Cram 2, McAd Exam 70-315 Authors: Kirk Hausman, Amit Kalani, Ed Tittel, Pages: 600, Published: 2003
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Basic Questions in Fatigue: Papers presented at the Symposium on fundamental questions and critical experiments on fatigue, Dallas,Tex. 1984 Authors: Jeffrey Tse-wei Fong, Robert P. Wei, Richard J. Fields, American Society for Testing Materials Committee E-9 on Fatigue, R. P. Gangloff, Robert Peg-ying Wei, ASTM Committee E-9 on Fatigue, Pages: 389, Published: 1988

Web:
Developing a Composite Control A composite control renders a user interface that reuses the functionality of existing controls. A composite control can synthesize properties from the ...
CodeProject: An ASP.NET Composite Control for US and UK dates ... A composite custom control and validator for handling US/UK dates; ... Sorry for the basic question, but how do I position the DateControl within a Web Form ...
Multiple dynamic compositecontrol question - ASP.NET Forums I have a compositecontrol that consists of a number of compositecontrols. When the page postbacks I need to re-create the controls so that ...
Creating a Composite Control in Asp .Net Jul 13, 2005 ... Explains how to create a composite control in Asp .Net using C#.
.NET Questions - Composite Control/User control So far the documentation I've seen always suggests you get either one or the other: composite controls are nice when using the finished ...
Composite Web Control Example This example shows how to create a control named Register that demonstrates the main steps required to implement a composite ASP.NET server control.
Composite control with dynamic composite controls I've created a TextBox composite control that consists of a label for the question being asked, and a textbox for the input. (There's ...
The Composite Control Pattern - Andy Smith's Blog The Composite Control Pattern. I've seen a a lot of people posting questions these days about composite controls. Most are having problems with viewstate. ...
A composite control - .NET ASP A composite control. Question posted by: James T. (Guest) on November 19th, 2005 11:02 AM. Hello! I developed a composite control that ...
CodeGuru: ASP.NET Tip: Creating a Composite Web Control Oct 11, 2006 ... As an alternative, you can create a composite control, which is harder to create , ... Send him your questions and feedback via e-mail at ...

Videos:
Striebig Control and Evolution Striebig Control and Evolution vertical saws for composite, wood and plastic materials. Please visit - www.striebig1.ru
88" YAK 54 - 06 In 2004, Extreme Flight RC released the original 50cc Yak-54 ARF. This legendary airframe redefined the meaning of quality and performance in ARF aer...
Fraternal Composite Exposure Control Training Part 2, This will explain how to use Adobe Elements to read the raw files. You can read the RGB values of the Gray Card . To determine if yo...
ShopNBC SpectronIQ 32" LCD HDTV & 300 Watt Home Theater System Update your home with a technologically advanced package from SpectronIQ at an incredible value! Recreate the entertainment set-up in your home with...
ANDERSON BAT MATRIX COMPOSITE VIDEO Reload with our Matrix SP. Meet the newest bat in the Anderson Arsenal. We’ve taken technology even DEEPER with this new composite bat. The “Lexan B...
74" YAK 54 - 01 Hot on the heels of the enormously popular 45" Extra 300-E is the new Extreme Flight RC 47" Yak-54-E ARF. This aircraft won the Best New Product awa...
WPF cube control for Himalia It works like a 3D tab control. When you press a link, the panel moves with a cool 3D cube movement. It can be used for composite elements in a Nav...
Composite-ARF.com Extra 330L 2.6M Comp-ARF 35% scale Extra 330L with DA-100 engine and JR 8411 servos. This video was taken a few months after I started flying the plane. I've had i...
ShopNBC SOYO 42" LCD HDTV Update your living room with this fantastic find from SOYO! With built-in ATSC and NTSC tuners, this splendid value from SOYO creates exceptional hi...
88" YAK 54 - 05 In 2004, Extreme Flight RC released the original 50cc Yak-54 ARF. This legendary airframe redefined the meaning of quality and performance in ARF aer...




Search This Site:










update web references during build

how does syndication work?

event for menu item select????

http://dotnetnuke.com down? or is it me?

logout process after closing browser

server error in '/' application using csk on web-host-plus servers

where to find the best webhosting service for my dotnetnuke?

different looking dnn site

problem with membership on remote server

dnn 2x cookie

hello world module, currently unavailable.

mycommand.fill(mydataset, "orderitems")

datagrid header image

featured ads - how to do rotating featured???

genericprincipal object and security

iis authenication problem

timeout problem when particular user logs on

masterpage and contentpage controls question

a procedure imported by system.data could not be loaded

probel reading xml file in module

logout help

adding design time support for customparse2 example

rsa cryptology problem

trying out forms authentication

nested user control for custom module

problem with ~/ in master page path.

installation - step 2: fails - how is that possible?

bug: 3.0.9 - parent page lists self in dropdownlist

creating a module that uses a different database than dnn's

anyone use wh4l for their web site?

 
All Times Are GMT