---
title: "Access<asp:FormView> field value from code behind"  
description: "Access<asp:FormView> field value from code behind"  
author: "Anonymous User"  
published: 2014-09-05  
updated: 2014-09-05  
canonical: https://www.mindstick.com/forum/2248/access-asp-formview-field-value-from-code-behind  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Access<asp:FormView> field value from code behind

I have am using an asp:[FormView](https://www.mindstick.com/forum/33556/how-to-use-formview-in-asp-dot-net) [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) with [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) such as:

<asp:[TextBox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) id="[FirstName](https://www.mindstick.com/interview/33973/how-to-split-the-full-name-into-firstname-and-lastname-in-sql-server)"

runat="[server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)" MaxLength="20"

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

I [cannot access](https://www.mindstick.com/forum/33726/inside-onclicklistener-i-cannot-access-a-lot-of-things-how-to-approach) the value of this field by its id -> "FirstName" in the [code behind](https://www.mindstick.com/forum/2199/call-javascript-s-function-from-code-behind) file.

Any [ideas](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas) on how I can access that value in the code behind file?

## Replies

### Reply by Sumit Kesarwani

Hi Goti, \
try this:\

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

string myValue = firstNameTextbox.Text;


---

Original Source: https://www.mindstick.com/forum/2248/access-asp-formview-field-value-from-code-behind

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
