What it's supposed to do:
I have a page that has some textboxes and 3 dropdown lists on it. After the user fills/selects their values, they hit an Add button to transfer the values into a datagrid at the bottom of the page. The textboxes ase just plain INPUT fields, the Dropdown lists are being filled by simple SQL in the Page_Load event, and the DataGrid is also being defined in the Page_Load event... nothing fancy, see HTML below.
<INPUT id=Grant type=text maxLength=20 size=20 name=Grant>
<ASPROPDOWNLIST id=lstType runat="server" DataValueField="CODTYP" datatextfield="LIBTGB"></ASPROPDOWNLIST>
<ASPATAGRID id=dgCriteria runat="server"></ASPATAGRID>
What it's doing:
When the Add button is clicked the field names and their associated values are transfered like they should be, except the values from the dropdowns. The dropdown field names transfer as they should if a value has been selected, but the selected values don't show up in the datagrid. The page knows it's been selected because the field name shows up. Can anyone see why it's behaving this way?
Judy
Private Sub cmdAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Dim scRow As DataRow
If Request("Grant" <> "" Then
scRow = dGrid.NewRow()
scRow("Field" = "Grant #"
scRow("Value" = Request("Grant"
dGrid.Rows.Add(scRow)
dGridView = New DataView(dGrid)
dgCriteria.DataSource = dGridView
dgCriteria.DataBind()
End If
If lstType.SelectedItem.Text <> " " Then
scRow = dGrid.NewRow()
scRow("Field" = "Type"
scRow("Value" = lstType.SelectedItem.Text
dGrid.Rows.Add(scRow)
dGridView = New DataView(dGrid)
dgCriteria.DataSource = dGridView
dgCriteria.DataBind()
End If
End Sub
I have a page that has some textboxes and 3 dropdown lists on it. After the user fills/selects their values, they hit an Add button to transfer the values into a datagrid at the bottom of the page. The textboxes ase just plain INPUT fields, the Dropdown lists are being filled by simple SQL in the Page_Load event, and the DataGrid is also being defined in the Page_Load event... nothing fancy, see HTML below.
<INPUT id=Grant type=text maxLength=20 size=20 name=Grant>
<ASPROPDOWNLIST id=lstType runat="server" DataValueField="CODTYP" datatextfield="LIBTGB"></ASPROPDOWNLIST>
<ASPATAGRID id=dgCriteria runat="server"></ASPATAGRID>
What it's doing:
When the Add button is clicked the field names and their associated values are transfered like they should be, except the values from the dropdowns. The dropdown field names transfer as they should if a value has been selected, but the selected values don't show up in the datagrid. The page knows it's been selected because the field name shows up. Can anyone see why it's behaving this way?
Judy
Private Sub cmdAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Dim scRow As DataRow
If Request("Grant" <> "" Then
scRow = dGrid.NewRow()
scRow("Field" = "Grant #"
scRow("Value" = Request("Grant"
dGrid.Rows.Add(scRow)
dGridView = New DataView(dGrid)
dgCriteria.DataSource = dGridView
dgCriteria.DataBind()
End If
If lstType.SelectedItem.Text <> " " Then
scRow = dGrid.NewRow()
scRow("Field" = "Type"
scRow("Value" = lstType.SelectedItem.Text
dGrid.Rows.Add(scRow)
dGridView = New DataView(dGrid)
dgCriteria.DataSource = dGridView
dgCriteria.DataBind()
End If
End Sub