CodeVerge.Net Beta


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

ASP.NET Web Hosting – 3 Months Free!



Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 6/20/2005 8:32:16 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 39 Favorited: 0 Favorite
2 Items, 1 Pages 1 |< << Go >> >|
ultraman69
Asp.Net User
Composite control event problem6/20/2005 8:32:16 PM

0/0

Hi everyone !

I'm trying to build a cutom toolbar control. I used a simple table with ImageButton. Then I created an event linked to each of the buttons so that the client will know which button has been clicked. So far, everything is working fine, BUT....

I also defined properties where the client can set the images of the buttons (using the ViewState). One for the enabled button and another one if the button is disabled. If I trap a click event on the client page and try to change the "Enabled" value of my button to "False" (so that it displays the "disabled" image) the control is not displaying the correct image. It's all because events are processed AFTER the CreateChildControl method. So the control is already drawn before the click event is raised.

ToolControl code :

Public Event FirstClick As EventHandler

' Invoke the delegates

'*******************************************

Protected Overridable Sub OnFirstClick(ByVal e As EventArgs)

RaiseEvent FirstClick(Me, e)

End Sub

Private Sub btnFirst_Click(ByVal Sender As Object, ByVal E As ImageClickEventArgs)

OnFirstClick(ImageClickEventArgs.Empty)

End Sub



Protected Overrides Sub CreateChildControls()

....Some code here.....

If Me.ButtonFirstVisible Then

         Me.Controls.Add(New LiteralControl(vbTab & vbTab & "<td id='btnFirst' onmouseover=" & Chr(34) & "ChangeColor(0, this.id)" & Chr(34) & " onmouseout=" & Chr(34) & "ChangeColor(1, this.id)" & Chr(34) & ">"))

         Dim btnFirst As New ImageButton

         If Me.ButtonFirstEnabled And Not Me.ImgSrcDisabledFirst = "" Then

               btnFirst.ImageUrl = Me.ImgSrcFirstButton

         Else

               btnFirst.ImageUrl = Me.ImgSrcDisabledFirst

         End If

         btnFirst.ImageAlign = ImageAlign.Middle

         btnFirst.ToolTip = strFirst

         AddHandler btnFirst.Click, AddressOf btnFirst_Click

         Me.Controls.Add(btnFirst)

         Me.Controls.Add(New LiteralControl("</td>" & vbCrLf))

End If

...Rest of the code here.....

End Sub


Client page code :

Private Sub ToolControl1_FirstClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolControl1.FirstClick

ToolControl1.ButtonFirstEnabled = False

End Sub


I even tried to remove all controls in the ToolControl "btnFirst_Click" method before recalling "CreateChildControl". It works, but the next button I click don't raise the event. I have no idea why.

Is there some kind of workaround for this kind of things ?
_________________________________________

Ultraman69
ultraman69
Asp.Net User
Re: Composite control event problem6/21/2005 2:06:53 PM

0/0

Well, if anyone's interested, here's what solved my problem : I cleared all controls after the event was fired and then I recreated them. It is totally not performant, but it's the only way I found to make it work.

ToolControl code :

Private Sub btnFirst_Click(ByVal Sender As Object, ByVal E As ImageClickEventArgs)

     OnFirstClick(ImageClickEventArgs.Empty)

     Controls.Clear()

     ClearChildViewState()

     Me.CreateChildControls()

End Sub


_________________________________________

Ultraman69
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET by Example Authors: Steven A. Smith, Pages: 552, Published: 2002
Topics in Control and Its Applications: A Tribute to Edward J. Davison Authors: Edward J. Davison, Daniel E. Miller, Li Qiu, Pages: 212, Published: 1999
Optimal Control of Singularly Perturbed Linear Systems and Applications: High-accuracy Techniques Authors: Zoran Gajic, Myo-Taeg Lim, Pages: 309, Published: 2001
From Web to Workplace: Designing Open Hypermedia Systems Authors: Kaj Grønbæk, Randall H. Trigg, Pages: 386, Published: 1999
Conference proceedings Authors: Institute of Electrical and Electronics Engineers, Man and Cybernetics (1990 International Conference on Systems, Los Angeles Calif, Pages: 929, Published: 1990
Realistic Evaluation Authors: Ray Pawson, Nick Tilley, Pages: 235, Published: 1997

Web:
Composite control event problem - ASP.NET Forums Composite control event problem. Last post 06-21-2005 10:06 AM by ultraman69. 1 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
Dynamically created controls in composite control RenderContents ... Dynamically created controls in composite control RenderContents method, problem with events. Last post 09-01-2008 2:25 PM by Peter Bucher. ...
CodeProject: MSFlexGrid Control on an ATL Composite Control. Free ... To check the problem you can do the following:. Create ATL Server Dll; Add ATL Composite Control; Right Click and insert MSFlexGrid Control; Add Event by ...
Continuing: Data binding to a CompositeControl I thought of using an event driven approach and have the control. ... The postback seems OK, but the naming of the controls becomes a problem if the BO is ...
C# .NET Custom composite control events not working OnFilter += new FilterHandler(ctrl_OnFilter); } My first problem is that the ... Custom composite control events not working - Scott Grosch 06-Apr-05 02:49 ...
Problem with composite control Talk about Problem with composite control. ... Victor Garcia Aprea [MVP]. Posts: n/a. Default Re: Problem with composite control ...
Problem with ATL Composite Control : atl I have a problem with the ATL Composite Control from Visual C++ . I want to make an OCX with a complex ... (I must call Detach method in OnDestroy event) ...
Validators in composite control firing prematurely Nov 29, 2005 ... problem is the validators are working to well and seem to be firing even on ...... Dynamic user control Event Handling (VS.NET Ent 2003) ...
CodeProject: An ASP.NET Composite Control for US and UK dates ... A composite custom control and validator for handling US/UK dates; Author: David ... NET control that shows events visually arranged in a day calendar. ...
ViewState problem: When Composite Control Inside Custom GridView ... ViewState problem: When Composite Control Inside Custom GridView. Options ... I have an issue while implementing Custom GridView control. ...

Videos:
Fourth composite rocket test Flight attempt #2 for our Lunar Lander Challenge entry "Ignignokt". In the first flight test, the throttle pulsated. Here, you can see that problem h...
Sukhoi Su-47: Russian: Су-47 Беркут Golden Eagle (Stereo!) To listen in STEREO click here: http://www.youtube.com/watch?v=iMnT5CyA24o&fmt=18 http://en.wikipedia.org/wiki/Su-47 The Sukhoi Su-47 Berkut (Russ...
Test Simple - An Objective Test of Your Abilities From the book "Test Simple": Test Simple measures two areas: 1) the degree of complexity one can handle; and, 2) the consistency with which one can h...
WORLD'S SMALLEST FIRST 4CH RC Helicopter !!! http://www.micro-flight.com Palm Size Helicopter 5" Rotor World's Smallest Helicopter Full 4 CH control. Palm Size Heli (Palmsize heli) A true 4 cha...
Russian Knights 2 The Russian Knights (Russian: Русские Витязи) are an aerobatic demonstration team of the Russian Air Force. Originally formed on April 5, 1991 at the...
Objects: they just work Google London Test Automation Conference (LTAC) Google Tech Talks September 8th, 2006 Presenter: Bob Binder
Republican Race-Baiter Ashley Todd Goes To Jail PITTSBURGH (KDKA) ― A campaign worker who claimed she was the victim of a politically-motivated attack in which she was beaten, kicked and cut, now ...
Russian Knights http://www.aviationlive.org Online Aviation Pics,Videos and Forum The Russian Knights (Russian: Русские Витязи) are an aerobatic demonstration team o...
McCain's campaign worker lied about racist attack Ashley Todd, a McCain campaign worker who claimed she was the victim of a politically-motivated attack in which she was beaten, kicked and cut, now a...
Charlie Rose - Bush's Iraq Strategy / Richard Clarke / Niki Caro Segment 1: David Sanger of The New York Times and Thomas DeFrank of the New York Daily News discuss President Bush's speech on his strategy for victo...




Search This Site:










message box not appearing on top

is it possible to get the value that is changed at javascript?

access a variable in another user control

designer problem with inherited global.aspx.cs

compare validator--urgent

referencing another page type from code behind

depending on user input (yes or no message box) server sided method must be executed

request.querystring problem

creating delete button for dynamically created controls?

transfer the image stored in a .gif file to an image column in a sql server table

itextsharp

how to set dynamic directory path for reading and writing file ?

creating a simple task list

slide show extender error

how to avoid having a 404 error page when uploading a file with more than 4mb size

using cache("varname") in classes???

request.querystring

how to clear validation errors programmatically?

require validationexpression

check folder to see if it is empty or not....?

problem with type.gettype

hyperlink

email input controls and submit button

today's date in a textbox (c#)

how to enable cache...?

tabstrip tabcontrol remove tab and reformat

local debugging for asp.net web applications in windowsxp sp2 edition operating system

too much data

passing values from a parent web control to child web control

storing objects in cookies

  Privacy | Contact Us
All Times Are GMT