sha_shivani
Member
- Joined
- Sep 28, 2006
- Messages
- 11
- Programming Experience
- 1-3
I am calling this method below from my data factory to Load users dropdown list.But i Argument exception was caught.Because there was a duplicate entry with the same name in the database.Can you tell me how can i get sorted list?
public SortedList ListEligibleAssignToUserByRefID(int RefId)
{
IDataReader reader = ExecuteReader(GetStoredProcedureCommand("usp_DALAvailableUsersByRefId"), new DictionaryEntry[] { new DictionaryEntry("RefId", RefId) });
SortedList users = new SortedList();
while (reader.Read())
{
users.Add(string.Format("{0},{1},{2}", reader["LastName"], reader["FirstName"], reader["VendorName"]), reader["UserId"]);
//Hashtable task = (Hashtable)this.FillFISDesktopObject(reader);
}
reader.Close();
return users;
}
Below is my dropdownlist method
Private Sub LoadUsers()
Dim users As New System.Collections.SortedList()
Dim Item As DictionaryEntry
Dim redirect As Boolean = False
Dim qs As New QryStrAdapters.ProcMan_Tasks_QS(Request.QueryString)
Me.thisProcessID = qs.ProcessInstanceID
Me.RefId = qs.ProcessInstanceID
Me.ClientRefNo = qs.ClientRefNo
Try
users = FISDesktop.Business.Service.TaskService.Instance().ListEligibleAssignToUserByRefID(RefId)
For Each Item In users
Dim newListItem As New ListItem()
newListItem.Text = Item.Key
newListItem.Value = Item.Value
ddlAssignedTo.Items.Add(newListItem)
Next
'If users.Count > 0 Then
' Me.ddlAssignedTo.DataSource = users
' Me.ddlAssignedTo.DataValueField = "vendorName"
' Me.ddlAssignedTo.DataTextField = ("lastName") & "," & ("FirstName")
' Me.ddlAssignedTo.DataBind()
'End If
Me.ddlAssignedTo.Items.Insert(0, New ListItem("--Select Users--", "0"))
Catch ex As Exception
redirect = True
Finally
users = Nothing
End Try
If redirect Then
Response.Redirect("ErrorScreen.aspx")
End If
End Sub
public SortedList ListEligibleAssignToUserByRefID(int RefId)
{
IDataReader reader = ExecuteReader(GetStoredProcedureCommand("usp_DALAvailableUsersByRefId"), new DictionaryEntry[] { new DictionaryEntry("RefId", RefId) });
SortedList users = new SortedList();
while (reader.Read())
{
users.Add(string.Format("{0},{1},{2}", reader["LastName"], reader["FirstName"], reader["VendorName"]), reader["UserId"]);
//Hashtable task = (Hashtable)this.FillFISDesktopObject(reader);
}
reader.Close();
return users;
}
Below is my dropdownlist method
Private Sub LoadUsers()
Dim users As New System.Collections.SortedList()
Dim Item As DictionaryEntry
Dim redirect As Boolean = False
Dim qs As New QryStrAdapters.ProcMan_Tasks_QS(Request.QueryString)
Me.thisProcessID = qs.ProcessInstanceID
Me.RefId = qs.ProcessInstanceID
Me.ClientRefNo = qs.ClientRefNo
Try
users = FISDesktop.Business.Service.TaskService.Instance().ListEligibleAssignToUserByRefID(RefId)
For Each Item In users
Dim newListItem As New ListItem()
newListItem.Text = Item.Key
newListItem.Value = Item.Value
ddlAssignedTo.Items.Add(newListItem)
Next
'If users.Count > 0 Then
' Me.ddlAssignedTo.DataSource = users
' Me.ddlAssignedTo.DataValueField = "vendorName"
' Me.ddlAssignedTo.DataTextField = ("lastName") & "," & ("FirstName")
' Me.ddlAssignedTo.DataBind()
'End If
Me.ddlAssignedTo.Items.Insert(0, New ListItem("--Select Users--", "0"))
Catch ex As Exception
redirect = True
Finally
users = Nothing
End Try
If redirect Then
Response.Redirect("ErrorScreen.aspx")
End If
End Sub