Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
Hi,

I have a GridView that is created dynamically. Now I want to add 'selectedIndexChanged' event to it. As the rows are also dynamic, I am unable to do this. Kindly help me with suitable solution.

Thanks...
Posted
Comments
abatechcal_sreya 18-Sep-13 6:14am    
Can somone share the code for this.

GridView NewDg = new GridView();
C#
NewDg.ID = "SubGridView" + e.Row.RowIndex.ToString();
 NewDg.DataKeyNames = new string[]{"logentry_id"};
 NewDg.SelectedIndexChanged += new EventHandler(NewDg_SelectedIndexChanged);
 NewDg.RowDataBound += new GridViewRowEventHandler(NewDg_RowDataBound);

hope this one will help u and improve rate my ans
 
Share this answer
 
v2
Comments
Omprakash Kukana 18-Sep-13 5:05am    
is it some help full for u mr.abatechcal_sreya
JUST GO TO DESIGN PAGE CLICK ON GRID VIEW AND THEN RIGHT CLICK ON GRID VIEW AND OPEN properties
and then go to event and double click on selected index changed it will be created
 
Share this answer
 
Comments
abatechcal_sreya 18-Sep-13 4:48am    
It is I think more complex than om thinks.This Grid is dynamically created.
GridView NewDg = new GridView();
Omprakash Kukana 18-Sep-13 4:51am    
ok but u sd tell this thing in above your question your question is not completely saying this thing u sd mention this in quetion u downvoted my ans u sdnt do this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900