Connecting Tech Pros Worldwide Help | Site Map

DataGridView CellContentClick Event

Member
 
Join Date: Jun 2007
Location: Kolkata,India
Posts: 65
#1: Jul 8 '09
Hi,

I am using datagridview and adding the CellContentClick event programmatically as:
this.grdSrchRefillOrdBooking.CellContentClick += new DataGridViewCellEventHandler(this.grdSrchRefillOrd Booking_CellContentClick);

This is working fine.

I have onle clear button which clears the DataGridview content.
Code for Clear Row : grdSrchRefillOrdBooking.Rows.Clear();

After clearing data when I am populating the grid again on button click,rows are getting populated correctly.
When I am clicking the content of the grid, the event fired twice one after another(function that binded with cellcontentclick).

Please suggest me the way to prevent this.

Regards,
Gyanendar
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,083
#2: Jul 8 '09

re: DataGridView CellContentClick Event


Have you tried removing the CellContentClick handler when you clear the rows....then add it again when you repopulate it?
Member
 
Join Date: Jun 2007
Location: Kolkata,India
Posts: 65
#3: Jul 9 '09

re: DataGridView CellContentClick Event


Thanks for the reply.

I found the solution.Actually this problem comming because handler got added every time in search Button click.
Reply