---
title: "Access textbox in itemtemplate"  
description: "Access textbox in itemtemplate"  
author: "Anonymous User"  
published: 2014-08-19  
updated: 2014-08-19  
canonical: https://www.mindstick.com/forum/2057/access-textbox-in-itemtemplate  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Access textbox in itemtemplate

I have 2 textboxes and a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) in a [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table), and a [Repeater](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) dynamically generates some rows at Page_Load function.

```
<asp:Repeater id="Repeater1" runat="server">    <ItemTemplate>        <tr>            <td><asp:Label CssClass="form-control" disabled="true" runat="server"><%# DataBinder.Eval(Container.DataItem, "sid") %></asp:Label></td>            <td><asp:TextBox CssClass="form-control" runat="server" ID="quiz1"></asp:TextBox></td>            <td><asp:TextBox CssClass="form-control" runat="server" ID="quiz2"></asp:TextBox></td>            <td><asp:Button ID="add" CommandName="add" runat="server" OnClick="addQuiz" Text="Add" CssClass="btn btn-success btn-sm form-control"/></td>        </tr>     </ItemTemplate></asp:Repeater>
```

How do I [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) the textboxes in the Repeater upon clicking the button in the row?

## Replies

### Reply by Pravesh Singh

Hi Ashish, try this:

```
protected void addQuiz(Object sender, EventArgs e){    var btn = (Button)
sender;    var item =(RepeaterItem) btn.NamingContainer;    var quiz1 =(TextBox) item.FindControl("quiz1");    var quiz2 =(TextBox) item.FindControl("quiz2");}
```


---

Original Source: https://www.mindstick.com/forum/2057/access-textbox-in-itemtemplate

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
