calvin Posted July 29, 2004 Posted July 29, 2004 I create few template column and bound column in datagrid. One of the template column contain the StudentMark. I want to know how to change that column to (Read only) or "Not" (Read only) when click the edit button. It is based on a dropdownlist to determine to read only or not. I think i must use the template column, since i need to do the validation to the StudentMark. (For example, If select value '1' in dropdownlist, the "StudentMark" is become 'Read only' and select '2' become vice versa. I was success to bind the datagrid and "StudentMark" become a textbox if I select '2'. Anyone know how to do if i select '1' become a label and '2' become textbox :confused: Thank you for any help and comments Calvin Quote
JRichmond Posted August 2, 2004 Posted August 2, 2004 (edited) If I'm reading your question right, you could do it at least 2 different ways. The first way is to use an EditItemTemplate column with the same controls as your ItemTemplate column, except with the StudentMark label replaced by a textbox. Then, when you postback from the DropDownList, you can set the DataGrid.EditItemIndex equal to the index of the DataGridItem that was clicked. To change it back, just change the EditItemIndex to -1. The second way to do it is to have a Label AND a TextBox bound to the StudentMark field. Then, just make one or the other visible, depending on what the value of your dropdown list is. I hope this helps. ;) Edited August 2, 2004 by JRichmond Quote
calvin Posted August 3, 2004 Author Posted August 3, 2004 Thank for your suggestion JRichmond. :D Quote
JRichmond Posted August 3, 2004 Posted August 3, 2004 Does that mean that it worked for you? :) Quote
calvin Posted August 4, 2004 Author Posted August 4, 2004 Just visible what i want Hi, I do two column, one is bound column and another is template column, i just visible the column what i want. Thank you :-\ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.