ACCESS<ASP:FORMVIEW> FIELD VALUE FROM CODE BEHIND

Goti Bandu

Total Post:119

Points:835
Posted by  Goti Bandu
 1646  View(s)
Ratings:
Rate this:

I have am using an asp:FormView control with elements such as:

<asp:TextBox id="FirstName"

runat="server" MaxLength="20"

Columns="15" Text='<%# Bind("FirstName") %>' />

I cannot access the value of this field by its id -> "FirstName" in the code behind file.

Any ideas on how I can access that value in the code behind file?

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: Access<asp:FormView> field value from code behind

    Hi Goti, 


    try this:

    var firstNameTextbox = FormViewId.FindControl("FirstName") as TextBox;

    string myValue = firstNameTextbox.Text;

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!