Help with DropDownList on String Value Field
Hi,
I'm trying to code a dropdownlist with a string field as the datavaluefield. I have mainly done
integer field lookups before, so I'm having problems with syntax. Here's my code for page_load,
indexChanged and BindGrid.
-------------------------------------
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Page.IsPostBack Then
Dim CurrentUser As SiteIdentity = CType(Context.User.Identity, SiteIdentity)
Dim CompanyName As String = CurrentUser.CompanyName
UserIdentifier.Text = UserIdentifier.Text & "<b>" & CurrentUser.CompanyName & "</b>"
Dim PropName As String = Request.Params("PropName")
DataGrid1.Attributes("PropName") = PropName
Dim PropNameDataView As DataView = _
Business.VendorEquipment.GetPropName(CompanyName). Tables(0).DefaultView
PropDropDown.DataSource = PropNameDataView
PropDropDown.DataBind()
If Not (PropName Is Nothing) Then
PropDropDown.SelectedIndex = PropDropDown.SelectedItem.Value
End If
BindGrid()
End If
End Sub
Protected Sub PropDropDown_IndexChanged( _
ByVal sender As Object, _
ByVal e As EventArgs)
Response.Redirect(("PropertyEquipment.aspx?PropNam e=" & _
PropDropDown.SelectedItem.Value))
End Sub
Private Sub BindGrid()
Dim PropName As String
If Not (DataGrid1.Attributes("PropName") Is Nothing) Then
PropName = DataGrid1.Attributes("PropName")
Else
PropName = PropDropDown.SelectedItem.Value
End If
Dim GVEDataSet As DataSet = New _
Business.VendorEquipment(PropName).GetVendorEquipm ent("PropName")
DataGrid1.DataSource = GVEDataSet
DataGrid1.DataBind()
End Sub
-------------------------------
I'm getting an error on attempting to load the page that states "Cast from String 'PropName'
to type'integer' is not valid.
Can anyone tell me what's wrong in this code.
Thx
Reid C.
Reid C.
__________________
Reid C.
|