Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to convert VB.NET to C#? DatalistObject.Items(i).FindControl("....")

$
0
0

I am fairly new to SharePoint.

I try to write the code to find the Label web controls inside the ItemTemplate of DataList in C#. (Get reference to the datalist row's Label control).

I am familiar with VB.NET, but I'm learning C#.

How to convert from VB.NET to C#?

VB.NET version

lblPdtID = CType(datalistPdt.Items(i).FindControl("lblPdtID"), Label)

Convert VB.NET to C#

C# version

lblPdtID = (Label) datalistPdt.Items(i).FindControl("lblPdtID"); // error line



Viewing all articles
Browse latest Browse all 7589

Trending Articles