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: 9/26/2005 2:39:21 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 12 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
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
Programming C#: Building .NET Applications with C# Authors: Jesse Liberty, Pages: 644, Published: 2005
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# 3.0 Authors: Jesse Liberty, Donald Xie, Pages: 607, Published: 2007
Essential ASP. NET with Examples in C#: With Examples in C# Authors: Fritz Onion, Pages: 393, Published: 2003
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006

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 ...
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 ...
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. ...
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. ...
Injecting Client-Side Script from an ASP.NET Server Control ... NET server controls are either directly or indirectly derived, ..... Note that the onclick event returns the result of the confirm() function call. ...
Wiring Up Event Handlers to Dynamically Created Custom Server Controls This article demonstrates how to dynamically add a server control and how to dynamically wire up ... Click event handler I am dynamically creating a System. ...
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 published section and it shows up on the ...
Introduction To Server Controls In ASP.NET The most important event for a Button control is the OnClick event. This event is triggered with a click on the button and submits the form to the server. ...
CodeProject: MultiUpload, a smarter file upload server control ... The HTML file input control and the ASP.NET FileUpload control derived from it ... Clicking the anchor tag triggers a Click event on an invisible file input ...
Server Control Events for the TextChanged and Click events is located on the server where the ASP. ..... We create a new class derived from EventArgs that exposes two read-only ...

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




Search This Site:










how to create the patches for the existing modules in dotnetnuke 3.1.1?

how to reuse controller from the core : reference required error (3.0.8)

customization of the aggregate page

does dnn3.0.4 integrate cs forums(asp.net forums)?

3.x compatible "refer a friend / email" skin object ??

going from asp and db driven pages to dotnetnuke3.x

new forum for beta or versions....

reporting add-in installation issue

difference between dotnetnuke & ibs & portal starter kit

no host or admin tabs

treeview findnode returns null on existing node

connect to asp.netwebadminfiles on a sql server 2000

ldap authentication

skin error?

string was not recognized as a valid datetime

install with xp & 2k3

how can i create a new access database in vwd ee !!!

transfering entire dnn site

pls respond urgent-how to open page from the link

shadow module 1.0

 
All Times Are GMT