Home > DeveloperSection > Forums > Access<asp:FormView> field value from code behind
Goti Bandu

Total Post:119

Posted on    September-05-2014 12:14 AM

 ASP.Net ASP.Net 

 1 Reply(s)
 1573  View(s)
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?

Sumit Kesarwani

Total Post:378

Posted on    September-05-2014 12:31 AM

Hi Goti, 

try this:

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

string myValue = firstNameTextbox.Text;

Don't want to miss updates? Please click the below button!

Follow MindStick