CodeVerge.Net Beta


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

MS SQL 2008 on ASP.NET Hosting



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: 9/26/2005 2:39:21 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 25 Favorited: 0 Favorite
5 Items, 1 Pages 1 |< << Go >> >|
ThirstyMind
Asp.Net User
Click event of a derived server control9/26/2005 2:39:21 AM

0/0

I am working VS2003 and C#. I have inherited from ImageButton control and implemented new methods such as MouseOverUrl. When I put this new control, while the MouseOverUrl is working fine, the click event of this control doesn't work. Please help

Thanks

ThirstyMind
joteke
Asp.Net User
Re: Click event of a derived server control9/26/2005 5:58:30 PM

0/0

Show the code, what you have implemented? Have you overridden something?


Thanks,

Teemu Keiski
Finland, EU
ThirstyMind
Asp.Net User
Re: Click event of a derived server control9/26/2005 11:17:01 PM

0/0

Hi,

The following is the complete code on the inherited imagebutton called MyTestButtons:

using System;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.ComponentModel;

namespace MyTestButtons

{

[DefaultProperty("Text"),

ToolboxData("<{0}:MyTestButton runat=server></{0}:MyTestButton>")]

public class MyTestButton : System.Web.UI.WebControls.ImageButton

{

private string text;

private string _strMouseOverImageURL;

private string _strMouseOutImageURL;

[Bindable(true),

Category("Appearance"),

DefaultValue("")]

public string Text

{

get

{

return text;

}

set

{

text = value;

}

}

[

Bindable(false),

Browsable(true),

Category("Appearance")

]

public string MouseOverImageURL

{

get

{

return _strMouseOverImageURL;

}

set

{

_strMouseOverImageURL = value;

MouseOverImageURLFromViewState=_strMouseOverImageURL;

}

}

protected string MouseOverImageURLFromViewState

{

get

{

return (string) ViewState["MouseOverImageURLFromViewState"];

}

set

{

ViewState["MouseOverImageURLFromViewState"] = value;

}

}

[

Bindable(false),

Browsable(true),

Category("Appearance")

]

public string MouseOutImageURL

{

get

{

return _strMouseOutImageURL;

}

set

{

_strMouseOutImageURL = value;

MouseOutImageURLFromViewState=_strMouseOutImageURL;

}

}

protected string MouseOutImageURLFromViewState

{

get

{

return (string) ViewState["MouseOutImageURLFromViewState"];

}

set

{

ViewState["MouseOutImageURLFromViewState"] = value;

}

}

protected override void OnPreRender(EventArgs e)

{

this.Attributes.Add("OnMouseOver", "this.src='"+ MouseOverImageURLFromViewState +"';");

this.Attributes.Add("OnMouseOut", "this.src='"+ MouseOutImageURLFromViewState +"';");

if(Enabled)

{

this.Visible=true;

}

else

{

this.Visible=false;

}

}

}

}

The following is the code on the aspx page were I put the control:

.
.
.

private void InitializeComponent()

{

this.MyTestButton.Click += new System.Web.UI.ImageClickEventHandler(this.MyTestButton_Click);

this.Load += new System.EventHandler(this.Page_Load);

}

private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)

{

TextBox1.Text = "Hello";

}

If the Click event of the control works fine, then the TextBox1 should display the word "Hello". But it doesn't happen. In the debug mode, the cursor doesn't even go to the ImageButton1_Click method. My advance thanks for your help!

joteke
Asp.Net User
Re: Click event of a derived server control9/27/2005 2:42:03 PM

0/0

You need to call base.OnPreRender(e); in your overridden OnPreRender method. If you don't, the control is not registered for postback data processing and won't raise events (as it doesn't load postback data either)
Thanks,

Teemu Keiski
Finland, EU
ThirstyMind
Asp.Net User
Re: Click event of a derived server control9/27/2005 11:33:00 PM

0/0

Thank you soooooo much! It worked!! Also thanks for the explanation why it didn't work in the first place.
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Developing Killer Web Apps with Dreamweaver MX and C# Authors: Chuck White, Pages: 409, Published: 2004
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Programming C#: Building .NET Applications with C# Authors: Jesse Liberty, Pages: 644, Published: 2005
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004
Essential ASP. NET with Examples in C#: With Examples in C# Authors: Fritz Onion, Pages: 393, Published: 2003

Web:
Examining the skmMenu Server Control Control class, which all ASP.NET server controls must be derived from ..... Web control's Click event, to which page developers can create a server-side ...
Server Control Events for the TextChanged and Click events is located on the server where the ASP. ...... Custom events can also implement a custom EventArgs-derived class to ...
ASP.Net UpDown Server Control Every server control is derived from Control or WebControl . .... OK, we have renderd the control, handled the click events on arrows and managed the state. ...
CodeProject: MultiUpload, a smarter file upload server control ... Dec 20, 2007 ... NET FileUpload control derived from it have important ... Clicking the anchor tag triggers a Click event on an invisible file input control. ...
Need Click Event to Fire from TextBox B. I tried creating a custom control derived from WebControl and was able to .... event handlers set up for my server control events. ...
Embarcadero Discussion Forums: Derived Control - Click Event ... I'm trying to create a control derived from TWinControl. I've declared the OnClick event in the ... control which received the click event instead of my control. Thanks, -- Warm Regards, ... Server Response from: jive2 ...
Wiring Up Event Handlers to Dynamically Created Custom Server Controls Jan 14, 2002 ... I have one class that is derived from System.Web.UI.WebControls. ... Click event handler I am dynamically creating a System.Web.UI.WebControl. ... Now we have our own custom Button server control. ...
ImageButton.OnClick Method (System.Web.UI.WebControls) The Click event is raised when the ImageButton control is clicked. ... The OnClick method also allows derived classes to handle the event without attaching a .... Other Resources. ImageButton Web Server Control Declarative Syntax ...
ASP .Net server control events order - Stack Overflow The Init event (and also the Unload event) for each child control occur before the ... In one my historic project, I derived all pages from my class "PageEx : System.Web.UI. ... Events on ASP.NET UserControl raise every other click? ...
Injecting Client-Side Script from an ASP.NET Server Control ... Apr 14, 2004 ... NET server controls are either directly or indirectly derived, ..... Note that the onclick event returns the result of the confirm() ...

Videos:
Fogos 2008 ! PLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE PROGRAM FREQUENTLY ASKED QUESTIONS LOCATED ON THE PROGRAM WEBSITE AT https ...
الجهاد PLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE PROGRAM FREQUENTLY ASKED QUESTIONS LOCATED ON THE PROGRAM WEBSITE AT https ...
الله اكبر PLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE PROGRAM FREQUENTLY ASKED QUESTIONS LOCATED ON THE PROGRAM WEBSITE AT https ...
قدرة الله قوية PLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE PROGRAM FREQUENTLY ASKED QUESTIONS LOCATED ON THE PROGRAM WEBSITE AT https ...
tutty shih tzu PLEASE READ VERY CAREFULLY THESE TERMS AND CONDITIONS AND THE PROGRAM FREQUENTLY ASKED QUESTIONS LOCATED ON THE PROGRAM WEBSITE AT https ...
1.c 1.c
AND1-dani And1-dani
Peller Dániel AND1
(888)MOAX.ORG Microsoft Offfice Accounting Xchange ... (888)MOAX.ORG Microsoft Offfice Accounting Xchange 4_IT_JOURNAL.wmv - 31 min - Apr 23, 2008 USStudios - http://www.onafree.com (1 Rating ...




Search This Site:










<partialcaching(120)> _ does not

extending datagrid with itemplate

server purposing webcast dec 7th

custom control databinding?

spla

event not firing inside nested custom web control

can we host asp.net website on a unix server

aspnix problems?

how to get rows and columns collection in a data bound server control, independent of datasource attached.

why to have both persistchildren and parsechildren attributes?

mp3 snapshot control

add image to control

converting ascx to server control

overrides borderstyle

hmmm.... no .net gurus were able to answer this?

thread.currentthread.currentculture

genuinely free asp.net web hosting?

embedding an xslt resource

asp.net treeview control

assembly not found

create webmatrix toolbox component

listbox listitem custom attributes (style), viewstate problem

formview

usercontrol - saving and reloading viewstate

composite control causing datagrid to not render

/sigh

exchange sals for 2005 and corp web access

dropdownlist with autocomplete and autopostback

adding a simple button to my control kill it!

advise: i have t1 and shared host

  Privacy | Contact Us
All Times Are GMT