In the design properties for that row there should be a field to the effect of Default Value. Enter Regular there.
HTH,
Ryan
I did that. Maybe something else is happening here tell me what you think. I have a dropdoen that is either enabled or not based on if you can select Regular or Decaf. I use a stored procedure for this and this: cmdAddItemToCartItems.Parameters.Add("@.regDec", ddlReg.SelectedValue)
If it's not enabled is the stored procedure inserting nothing and overriding the default value? I tried this in my code (with and without the default value set) too:
If Me.ddlReg.Enabled = False Then
cmdAddItemToCartItems.Parameters.Add("@.regDec", "Regular").ToString()
Else
cmdAddItemToCartItems.Parameters.Add("@.regDec", ddlReg.SelectedValue)
End If
It seemed like it worked and then didn't work... maybe I'm just crazy, I don't know. Any suggestions?
I would do it this way. Don't provide the DropDownList if they can't select from it. Instead, use a Label control and display that it is Regular. Then, use that to determine what you are going to insert into the database for that row.
i.e.
If lblReadOnly.Visible Then
cmdAddItemToCartItems.Parameters.Add("@.regDec", lblReadOnly.Text)
Else
cmdAddItemToCartItems.Parameters.Add("@.regDec", ddlReg.SelectedItem.Value)
End If
HTH,
Ryan
No comments:
Post a Comment