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!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 9/22/2005 2:43:41 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 148 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
lotek
Asp.Net User
Custom ItemDataBound9/22/2005 2:43:41 AM

0/0

I created a custom control and want to add a similiar event to the ItemDataBound event. How can i do this?

Thanks
Matt
FancyKetsup
Asp.Net User
Re: Custom ItemDataBound9/22/2005 10:22:52 AM

0/0

Without seeing any code here is my 2 cents and a shot in the dark at what you are asking.
Lets call the place in your control where you do databinding "MyDataBindingMethod".  Then all we need to do is define the event and handler and if you wish custom event args I will not use custom args here, and simply use the provided System.EventArgs

public event EventHandler MyCustomDataBoundEvent;
public void MyCustomDataBoundEvent(object sender, EventArgs e)
 {
      if (MyCustomDataBoundEvent!= null) 
      {
             MyCustomDataBoundEvent(this, e);
      } 
 }

protected void MyDataBindingMethod(){
//this method is already defined in your control somewhere
// we can use it to call MyCustomDataBoundEvent
some code to bind data to your control
//then next lets call our custom event
MyCustomDataBoundEvent(this,System.EventArgs.Empty);
}

Thats it, very simple! You can also use attributes to define a default event for your control. The advantage of this is that when you double click the control VS automatically adds the code to the code behind and wires up the event for you, pretty slick.

here is and example...

[DefaultEventAttribute("MyCustomDataBoundEvent")]
public class MyCustomControl : WebControl
 {....}

notice this has to be defined at the class level not the event definition.

Hope this helps!
Answering a question increases your knowledge asking a question shows your Intelligence!
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
ASP.NET Data Web Controls Kick Start: Kick Start Authors: Scott Mitchell, Pages: 418, Published: 2003
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
A First Look at ASP.NET V. 2.0 Authors: Alex Homer, Dave Sussman, Rob Howard, Pages: 498, Published: 2004
Pro ASP. Net 3. 5 Server Controls and AJAX Components Authors: Rob Cameron, Dale Michalk, Pages: 740, Published: 2008
ASP.NET 1.0 Namespace Reference with VB.NET Authors: Jason Bell, Amit Kalani, Dave Gerding, Matt Milner, John Schenken, Matt Gibbs, Bruce Lee, Andy Elmhorst, Mike Clark, Alex Homer, Pages: 889, Published: 2002
ASP.NET in a Nutshell: A Desktop Quick Reference Authors: G. Andrew Duthie, Matthew MacDonald, Pages: 979, Published: 2003
Professional ASP.NET 1.1 Authors: Alex Homer, Dave Sussman, Rob Howard, Brian Francis, Karli Watson, Richard Anderson, Pages: 1337, Published: 2004
Applied ADO.NET: Building Data-Driven Solutions Authors: Mahesh Chand, David Talbot, Pages: 887, Published: 2003
ASP. NET 1.0 Namespace Reference with C# Authors: Jason Bell, Pages: 960, Published: 2002
Professional ASP.NET 1.0: Updated and Tested for Final Release of ASP.NET V.1.0 Authors: Richard Anderson, Alex Homer, Dave Sussman, Karli Watson, Pages: 1354, Published: 2002

Web:
Creating an ItemDataBound Event Delegate for a Nested Repeater Nov 8, 2008 ... By creating a delegate (a reference) to the ItemDataBound event of the ... for that custom control so that when the ItemDataBound event was ...
ItemDataBound Use the ItemDataBound event handler to make changes to items as they are bound to the data. For example, you can set custom attributes based on other fields ...
Skipping the Header in ItemDataBound - Quickduck Jul 31, 2007 ... I often subscribe to the ItemDataBound event in a repeater to perform custom logic for each item within the repeater (for example, ...
ListView and ItemDataBound event, what template am I in? - ASP.NET ... null) { ... my custom code ...}" in the itemdatabound event codebehind. Not the way I wanted to find out which template I'm in, ...
ItemDatabound | Mark van Aalst Besides that I build custom Asp.Net applications and I love to play around ... you need to raise an eventhandler which triggers the ItemDataBound handler. ...
ItemDataBound The ItemDataBound event is fired for each item that is being bound. ... //you can set custom attributes of the combobox items and read their values from the ...
ListView.ItemDataBound Event (System.Web.UI.WebControls) Public Event ItemDataBound As EventHandler(Of ListViewItemEventArgs) ... This enables you to perform a custom routine whenever this event occurs, ...
Datagrid ItemDataBound Event Problem Reload this Page Datagrid ItemDataBound Event Problem .... NET 2.0 XML, BOOK: Professional Web Parts and Custom Controls ASP. ...
Best way to implement custom control: Repeater vs. Anything Else easy way to do it, rather then writing custom code on ItemDataBound event or ItemCreated and adding HTML text programmatically. ...
itemdatabound Blog entries tagged with itemdatabound ... In this post I will show you how to extend your PageList so you can use ItemDataBound. ... Custom Properties ...




Search This Site:










sql command --> select distinct

newbie question

how different is vs.net 2002 from 2003?

e-commerce

visual studio 2005 - asp publishing to iis local and remote

if isdbnull repeader data help

a simple way to assign an rgb hexidecimal value to a forecolor property

unc path not found error

anybody know what is webfarm ?

what gives with these divs (why do my divs shrink into near-nothingness)?

extract part of a string

hyperlink problem

counting the number of files in a directory

aprove user

how do i progmatically go back to previous page

html input file to get directories/folders instead of files

get id of record you just inserted

problem in importing class

several asp errors on iis

this like forum

asp.net c# authentication

console.writeline

what is the best way to make an invoice page?

need helped with stored procedure syntax

creating a loop

new to asp.net

allow a user to add a page

generate report on statistic of advertisement tables

moving default.asp into a sub folder

how to get the list .net frameworks installed?

  Privacy | Contact Us
All Times Are GMT