I do something similar with my GridViews. In view mode, I just have a
representaton of the value. When I switch to Edit mode is when I want
to show my checkboxes and such.
To get values out of them you need to handle the GridView.RowUpdating
event. The code below (my GridView.RowUpdating event) finds the
txtCareerHi control in the selected GridView row and mirrors it in a
TextBox control stored in memory. On my form, the TextBox is a multi-
line TextBox and I want to preserve the vbCrLf characters. The funny
thing is that in view mode, I need to render them as HTML "<br />"
tags while in the TextBox, I need vbCrLf. I store the <br /tags in
my database.
' converts vbCrLf to <br /tag for browser display. The <br /
tags are stored in the database
Dim career As TextBox
career =
CType(gridCareer.Rows(e.RowIndex).FindControl("txt CareerHi"), TextBox)
Dim strCareer As String
strCareer = career.Text.Replace(vbCrLf, "<br />")
e.NewValues.Add("career_hi", strCareer)
gridCareer.DataBind()
My problem is that the values I want for my RadioButtonLists and
DropDownLists are stored in my database. I need a value and text. How
can I bind the RadioButtonList with value and text properties? They
only exist when the row enters Edit mode.
Cheers
Mike