jgoodman00
Programmer
- Jan 23, 2001
- 1,510
I am using a dropdown within a datagrid to edit existing records in an underlying table.
I used the example from 4guysfromrolla.com & modified the GetSelIndex function slightly for my needs. I currently have it on my aspx page.
I now have several aspx pages, & need to use this function on all of them, so I want to move the function into a module so all of the pages have access to the same function.
The only problem with this is the dataset. The dataset is on each aspx page, but I need to pass this into the function. I have tried doing this from the aspx page:
Or
Neither of these work though.
Any suggestions?
James Goodman MCSE, MCDBA
I used the example from 4guysfromrolla.com & modified the GetSelIndex function slightly for my needs. I currently have it on my aspx page.
Code:
Function GetSelIndex(ByRef TableName As String, ByRef ColumnName As String, ByRef Val As String) As Integer
Dim iLoop As Integer
'Loop through each row in the DataSet
Dim dt As DataTable = Me.dsMisc.Tables(TableName)
For iLoop = 0 To dt.Rows.Count - 1
If Int32.Parse(Val) = _
Int32.Parse(dt.Rows(iLoop)(ColumnName)) Then
Return iLoop
End If
Next iLoop
End Function
I now have several aspx pages, & need to use this function on all of them, so I want to move the function into a module so all of the pages have access to the same function.
The only problem with this is the dataset. The dataset is on each aspx page, but I need to pass this into the function. I have tried doing this from the aspx page:
Code:
SelectedIndex='<%# GetSelIndex("sp_StaffName", "StaffID", Container.DataItem("StaffID"),dsMisc) %>'
Code:
SelectedIndex='<%# GetSelIndex("sp_StaffName", "StaffID", Container.DataItem("StaffID"),"dsMisc") %>'
Any suggestions?
James Goodman MCSE, MCDBA