| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Can I set the Enabled or Visible properties of the controls (textboxes, checkboxes) displayed by default in edit mode, depending on the value of some other column? Or must I convert the column to a template column first? What I mean is, I can correctly get the value of the default textbox in a gridview cell when edited, using: s = CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).Text but I can't set that textbox to disabled or hidden using CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).enabled=false or CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).visible=false although I have intellisence for them. The message I get is: "Specified argument was out of the range of valid values. Parameter name: index" Why? |
|
#2
| |||
| |||
| Also, how can I change the ReadOnly property of a field, when it's about to enter the edit mode? |
|
#3
| |||
| |||
| You must've been looking in different places. In the same place, if you don't get an exception because of index in s = CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).Text you can't get it in CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).enabled=false since index is used before you get to Enabled property. -- Eliyahu Goldin, Software Developer Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net "Savvoulidis Iordanis" <SavvoulidisIordanis@discussions.microsoft.com> wrote in message news:45223B70-51F2-41B4-AD74-AC69CE5A942A@microsoft.com... > Can I set the Enabled or Visible properties of the controls (textboxes, > checkboxes) displayed by default in edit mode, depending on the value of > some > other column? Or must I convert the column to a template column first? > What I > mean is, I can correctly get the value of the default textbox in a > gridview > cell when edited, using: > > s = CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).Text > > but I can't set that textbox to disabled or hidden using > > CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).enabled=false > or > CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).visible=false > > although I have intellisence for them. > The message I get is: > "Specified argument was out of the range of valid values. Parameter name: > index" > > Why? |
|
#4
| |||
| |||
| RowEditing event should be good for this. -- Eliyahu Goldin, Software Developer Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net "Savvoulidis Iordanis" <SavvoulidisIordanis@discussions.microsoft.com> wrote in message news:C337A7EE-DBCD-4982-B5DF-C1694DB7DF46@microsoft.com... > Also, how can I change the ReadOnly property of a field, when it's about > to > enter the edit mode? |
|
#5
| |||
| |||
| What I need is a code excerpt. I couldn't manage to write it properly. I can't event get correct object reference to have intellisence for .Readonly |
|
#6
| |||
| |||
| Boh the following statements are used in RowCommand event. The 2nd one gives the exception s = CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).Text CType(grd_users.Rows(index).Cells(4).Controls(0), TextBox).enabled=false Why? |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.