Click here to Skip to main content
15,898,953 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
DO you know why this code have error

string FolderID = grdCalls.SelectedDataKey[0].ToString() :-\
Posted
Updated 20-Oct-10 23:42pm
v2
Comments
Hiren solanki 21-Oct-10 5:42am    
appropriate subject replaced.
Sandeep Mewara 21-Oct-10 7:33am    
What error?
Hiren solanki 23-Oct-10 0:51am    
you could accept my answer if it solved.

"string FolderID = grdCalls.SelectedDataKey[0].ToString() "


It will not show you a Compile time error Because at a time of compilation compiler doesn't know Either you have used multiple Datakeys or not.

i.e
C#
DataKeyNames=CustID,ProductID


If you have used single DataKeys i.e
DataKeyNames = CustID

then you dont need to pass Index at codeside,

You can pass the index if you have used multiple keys as described above.

Hope it helps.

Please vote and Accept Answer if it Helped.
 
Share this answer
 
Comments
raheleh_es 23-Oct-10 0:49am    
Thank 's .....
you help me
Thank's...... Thank's....... Thank's
raheleh_es 23-Oct-10 2:52am    
Hiren

How to return value when I have to Key???????????
Hiren solanki 23-Oct-10 2:57am    
if using singledatakey
gv.DataKeys[e.NewEditIndex].Value;
if using multipledatakey
gv.DataKeys[e.NewEditIndex].Values[0];

mark accept answer if it helped.
raheleh_es 23-Oct-10 3:46am    
Hiren

I can't Edite or update data
I read multiple value and pass to next page from Query
raheleh_es 23-Oct-10 5:12am    
sorry
I don't Edite or update data
Not sure, you could be missing a ; perhaps?

If that's not it, please post the error message and give us a clue...
 
Share this answer
 
v2
Comments
Rajesh Anuhya 21-Oct-10 5:39am    
Good catch .., he missed the ";"
AFAIK.., SelectedDataKey does not supports the index., remove the index and try again

go through the below link..

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selecteddatakey.aspx[^]

NOTE: Read the guidlines before posting a question, subject line should be in proper manner...
 
Share this answer
 
v2

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