---
title: "How to Disable/Enable input-box in aspx with value from SQL"  
description: "How to Disable/Enable input-box in aspx with value from SQL"  
author: "Anonymous User"  
published: 2015-01-26  
updated: 2015-01-27  
canonical: https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql  
category: "asp.net"  
tags: ["html", "input validation"]  
reading_time: 1 minute  

---

# How to Disable/Enable input-box in aspx with value from SQL

Once again I cannot find what I want on SO, so:

**I want to [disable](https://www.mindstick.com/forum/33825/how-to-disable-right-click-on-body-and-images-in-web-application) [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) boxes in a [repeater](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) [reading](https://www.mindstick.com/articles/126273/books-commonly-found-on-college-reading-lists) [values](https://www.mindstick.com/forum/327/sum-textbox-values) from my MS-[SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) if the [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) is False.**

**[Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) snippet**

```
  <tbody>    <asp:Repeater ID="myList"
runat="server" EnableViewState="true">    <ItemTemplate>         <tr>             <td>               
<input type="text" disabled="<%#
bool.Parse(Eval("Value1").ToString()) == true ? :
"disabled" %>" />            </td>            <td>               
<input type="text" disabled="<%# bool.Parse(Eval("Value2").ToString())
== true ? : "disabled" %>" />            </td>
```

It's the

"disabled="<%# bool.Parse([Eval](https://www.mindstick.com/forum/2167/inline-coding-one-more-eval-merge)("Value1").ToString()) == [true](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true) ? : "disabled" %>"

I would like help with.

## Replies

### Reply by Anonymous User

Thank you Kruni Patil. Here is what I did:

```
protected void myList_ItemDataBound(object sender, RepeaterItemEventArgs e)        {            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)            {                DataRowView row = (DataRowView)e.Item.DataItem;                 TextBox txtBoxM = (TextBox)e.Item.FindControl("TextBox1");                TextBox txtBoxT = (TextBox)e.Item.FindControl("TextBox2");                 txtBoxM.Enabled = bool.Parse(row["Value1"].ToString());                txtBoxT.Enabled = bool.Parse(row["Valu2"].ToString());             }        }
```


---

Original Source: https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
