Disable/Enable input-box in aspx with value from SQL

Joakim M

Once again I cannot find what I want on SO, so:

I want to disable input boxes in a repeater reading values from my MS-SQL if the value is False.

Code 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("Value1").ToString()) == true ? : "disabled" %>"

I would like help with.

Joakim M

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());

            }
        }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Value not extracted from input box

From Dev

Get value from input box added by script

From Dev

Not Updating setTimeout() value on click from input box

From Dev

Unable to read value from input box

From Dev

seting default dropdownlist value from sql table in aspx

From Dev

Aspx get value of dynamically added text box

From Dev

Multiply value from input box to a fixed value in a table (HTML)

From Dev

Add Value To Input Box

From Dev

How to Divide 1 value from input box to 10 another input box divided by 10 without rounding

From Dev

Store variable from input box and display value in p tag

From Dev

PHP Select an Item from a Combo box and set an input field with the value

From Dev

How to get the input box value from form to iframe?

From Dev

Retrieve input value from Jquery UI dialog box

From Dev

Excel VBA - Add value from input box to list in column

From Dev

Input from Entry box

From Dev

not able to get value from aspx page to aspx.cs

From Dev

How to pass value from aspx.cs to aspx

From Java

Get the value in an input text box

From Dev

Input box text value trick

From Dev

Input text box value is not changing

From Dev

save the value of text box that has been selected from sql database

From Dev

GTK3 :How to receive input value from entry/input box?

From Dev

(PHP) How can I make input hidden data to get value from input box

From Dev

JQuery hide input box but not input's value

From Dev

pass value from ashx to aspx page

From Dev

Getting value of variable from aspx to codebehind in silverlight

From Dev

Angular 2 enable an input box from the component using a checkbox value from template

From Dev

How to get the value of html input in aspx view page in mvc?

From Dev

How can i get value from three input text box at time in jquery

Related Related

  1. 1

    Value not extracted from input box

  2. 2

    Get value from input box added by script

  3. 3

    Not Updating setTimeout() value on click from input box

  4. 4

    Unable to read value from input box

  5. 5

    seting default dropdownlist value from sql table in aspx

  6. 6

    Aspx get value of dynamically added text box

  7. 7

    Multiply value from input box to a fixed value in a table (HTML)

  8. 8

    Add Value To Input Box

  9. 9

    How to Divide 1 value from input box to 10 another input box divided by 10 without rounding

  10. 10

    Store variable from input box and display value in p tag

  11. 11

    PHP Select an Item from a Combo box and set an input field with the value

  12. 12

    How to get the input box value from form to iframe?

  13. 13

    Retrieve input value from Jquery UI dialog box

  14. 14

    Excel VBA - Add value from input box to list in column

  15. 15

    Input from Entry box

  16. 16

    not able to get value from aspx page to aspx.cs

  17. 17

    How to pass value from aspx.cs to aspx

  18. 18

    Get the value in an input text box

  19. 19

    Input box text value trick

  20. 20

    Input text box value is not changing

  21. 21

    save the value of text box that has been selected from sql database

  22. 22

    GTK3 :How to receive input value from entry/input box?

  23. 23

    (PHP) How can I make input hidden data to get value from input box

  24. 24

    JQuery hide input box but not input's value

  25. 25

    pass value from ashx to aspx page

  26. 26

    Getting value of variable from aspx to codebehind in silverlight

  27. 27

    Angular 2 enable an input box from the component using a checkbox value from template

  28. 28

    How to get the value of html input in aspx view page in mvc?

  29. 29

    How can i get value from three input text box at time in jquery

HotTag

Archive