Gridview with full-screen editing question
-
I have a gridview control on my web page named gvItems. I have items and serial numbers defined on the gridview. I allow our customers to add serial numbers for their products. I use full-screen editing and I do not use the Edit / Update / Cancel link buttons. As you can see in my HTML below, I have a textbox named txtSerialNum. As I load the gridview rows from my SQL stored procedure, I have a column which tells me whether this item requires a serial number. If it does require a serial number, then I want to allow them to enter it like it is now. But if the item does not require a serial number, then I want to make the textbox enabled=false or readonly. How can I accomplish this? I assume I can use one of the gridview events but not sure which one. Here is my gridview code. I can post my C# code but the gridview is populated correctly already.
-
I have a gridview control on my web page named gvItems. I have items and serial numbers defined on the gridview. I allow our customers to add serial numbers for their products. I use full-screen editing and I do not use the Edit / Update / Cancel link buttons. As you can see in my HTML below, I have a textbox named txtSerialNum. As I load the gridview rows from my SQL stored procedure, I have a column which tells me whether this item requires a serial number. If it does require a serial number, then I want to allow them to enter it like it is now. But if the item does not require a serial number, then I want to make the textbox enabled=false or readonly. How can I accomplish this? I assume I can use one of the gridview events but not sure which one. Here is my gridview code. I can post my C# code but the gridview is populated correctly already.
The event you are looking for is
RowDataBound
. Add it to your gridview like this:And write your code in that event handler (gvItems_RowDataBound).
-
The event you are looking for is
RowDataBound
. Add it to your gridview like this:And write your code in that event handler (gvItems_RowDataBound).
Thanks! That worked perfectly.