Formview FindControl conversion to c#

  • Thread starter Thread starter sck10
  • Start date Start date
S

sck10

Hello,

I am trying to get the value of a control in a FormView. In vb, I would use
the following:

e.NewValues("ServiceIdeaQ01") =
CType(this.fvServiceIdea.FindControl("lblServiceIdeaQ01Edit"), Label).Text

For c#, what I have found on the web is the following:

Label ServiceIdeaQ01Label =
(Label)this.fvServiceIdea.Row.FindControl("lblServiceIdeaQ02Item");
e.NewValues("ServiceIdeaQ01") = ServiceIdeaQ01Label.Text;

Is there a way in c# to do the same thing with one line? For some reason, I
can't get the "Text" argument:

(Label)this.fvServiceIdea.Row.FindControl("lblServiceIdeaQ02Item").Text;

Thanks, sck10
 
Is there a way in c# to do the same thing with one line? For some reason,
I can't get the "Text" argument:

(Label)this.fvServiceIdea.Row.FindControl("lblServiceIdeaQ02Item").Text;

((Label)this.fvServiceIdea.Row.FindControl("lblServiceIdeaQ02Item")).Text;
 
Back
Top