---
title: "Bind ID dynamically on a textbox"  
description: "Bind ID dynamically on a textbox"  
author: "Mark M"  
published: 2014-12-11  
updated: 2014-12-12  
canonical: https://www.mindstick.com/forum/12784/bind-id-dynamically-on-a-textbox  
category: "asp.net"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Bind ID dynamically on a textbox

I have

<[asp](https://www.mindstick.com/articles/751/introduction-to-asp-dot-net-mvc):[TextBox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) ID="txtBidAmmount<%#Eval("id") %>" Width="250" runat="[server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)"></asp:TextBox>

That wouldn't work and I have read some [options](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas) that I have to [replace](https://yourviews.mindstick.com/view/81330/cow-antibody-research-in-usa-a-step-ahead-to-replace-plasma-therapy) the " with ', so I did:

<asp:TextBox ID='txtBidAmmount<%#Eval("id") %>' Width="250" runat="server"></asp:TextBox>

But I get:

[Parser](https://www.mindstick.com/articles/742/xml-parser-in-php) [Error Message](https://www.mindstick.com/forum/23174/error-message-the-page-you-are-requesting-cannot-be-served-because-of-the-extension-configuration): 'txtBidAmmount<%#Eval("id") %>' is not a valid identifier.

## Replies

### Reply by Takeshi Okada

```
<asp:GridView ID="EmployeesNoSuffix" runat="server"
   
AutoGenerateColumns="false" ClientIDMode="Predictable"><Columns>   
<asp:TemplateField HeaderText="ID">        
<ItemTemplate>             
<asp:Label ID="EmployeeID" runat="server"
Text='<%# Eval("ID") %>' />        
</ItemTemplate>    </asp:TemplateField>   
<asp:TemplateField HeaderText="Name">        
<ItemTemplate>             
<asp:Label ID="EmployeeName"       
runat="server" Text='<%# Eval("Name") %>'
/>        
</ItemTemplate>   
</asp:TemplateField></Columns></asp:GridView>
```

## Output HTML

```
<table id="EmployeesNoSuffix" style="border-collapse: collapse"    
cellspacing="0" rules="all" border="1">  <tbody>    <tr>       <th scope="col">ID</th>       <thscope="col">Name</th>    </tr>    <tr>      
<td><span id="EmployeesNoSuffix_EmployeeID_0">1</span></td>      
<td><span id="EmployeesNoSuffix_EmployeeName_0">EmployeeName1</span></td>    </tr>    ...    <tr>      <td>         <span id="EmployeesNoSuffix_EmployeeID_8">9</span>      </td>      <td>         <span id="EmployeesNoSuffix_EmployeeName_8">EmployeeName9</span>      </td>    </tr>  </tbody></table>
```

### Reply by Anonymous User

try this

ID='<%# "txtBidAmmount" + eval("id") %>'

OR

ID='<%# Eval("id", "txtBidAmmount {0}") %>'


---

Original Source: https://www.mindstick.com/forum/12784/bind-id-dynamically-on-a-textbox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
