We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Event to use when user clicks on an item in Gridlist control

Hi
I have a requirement, wherein if the user clicks or selects an item in grid list control, the item is added in another grid control. I used SelectedValueChanged() event, but this also gets fired initially when data is bound to grid control.
Next i tried using Click() event. This works fine, but if user click anywhere (any free space) on grid control the selected value(if any) is added.
I want the item to be added only when a user clicks on a particular item.
Please find the attached sample application.




GridListTest.zip

2 Replies

JJ Jisha Joy Syncfusion Team November 12, 2007 01:28 PM UTC

Hi Arun,

Thank you for posting query to us.

The mentioned behavior can be achieved by handling the Grid.CellClick event of GridListControl.
Here is the code snippets:

this.glcSample.Grid.CellClick += new GridCellClickEventHandler(Grid_CellClick);

void Grid_CellClick(object sender, GridCellClickEventArgs e)
{
clsData objDat = (clsData)glcSample.Items[e.RowIndex-1];
Add(objDat);

}

Please refer the modified sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Grid.Windows/69768/main.htm

Please try this and let me know if this helps.

Regards,
Jisha




AR Arun November 13, 2007 01:12 PM UTC

Hi Jisha
Thank you. It worked fine.

Regards
Arun


Loader.
Live Chat Icon For mobile
Up arrow icon