Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How to convert below code to c#:

CType(GvInvoiceDetails.SelectedItem.Cells(0).FindControl("lblItemId"), LinkButton).Text.


I Tried this but not working.
((LinkButton)GvInvoiceDetails.SelectedRow.Cells[0].FindControl("lblItemId")).Text;
Posted
Comments
Thomas Daniels 15-Dec-15 8:33am    
How is it "not working"? Do you get a compiler error, runtime error or an unexpected result?

In the vb.net version it's GvInvoiceDetails.SelectedItem, the c# is GvInvoiceDetails.SelectedRow. To be truly equivalent they both need to use the same property.
 
Share this answer
 
C#
((LinkButton)GvInvoiceDetails.SelectedItem.Cells(0).FindControl("lblItemId")).Text


Not sure as to why not working, but after cells change from brackets[] to parenthesis
 
Share this answer
 

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