Skip to content

How to access FormView value in .cs file

Amit Khandelwal

Asked Sep 17, 2012, 10:34 AM EDT1 answer
Share
LinkedInX
Please anyone tell me......that how to access formview value of .aspx page to .cs page.....

thanks

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Akkiraju Ivaturi
    0
    You might have to use something like this:

    Suppose if you have a label control in the formview with name "lblPrice" you have to use the following code to access the control value.

    string price = ((Label)MyFormView.FindControl("lblPrice")).Text;

    Likewise, you have to use the FindControl method and cast the control to appropriate control in the asp.net and then use the right property to get the value. In this case we got a control from FormView and then casted it to Label and used the Text property to get the value.

    Let me know if you have any questions.
    0