Click here to Skip to main content
15,036,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a form with dropdown and listboxes.
I am using these to allow the user to filter the results they will see on a grid. There are 1000s of codes and the user may want to see 1 or 2. Therefore they select what they want from the dropdown box and add to the listbox.


When the user selects an item from the drop down box it must be added to the listbox and removed from the dropdown box. When a user selects an item and presses another button underneath the listbox the selected item must be removed from the listbox and added to the dropdown box.

I have tried these 2 sites.

http://dotnetco.de/Blog/ID/26/Using-JavaScript-on-listboxes-in-ASPnet.aspx
http://www.vijaykodali.com/Blog/post/2007/12/14/Add-Delete-Items-in-DropDownList2c-ListBox-using-Javascript.aspx

The problem with the first is that the listbox is cleared after postback. Also when items are removed from the listbox they are not removed from the hidden field.
The problem with the second is that it adds information from a textbox not a dropdown box.
Posted
Comments
Karthik_Mahalingam 20-Jan-14 11:39am
   
need to be done in javascript or cs ?

Here is the defaultaspx.cs

C#
 public List<dropdowndata> VSDropDownData
        {
            get { return (List<dropdowndata>)ViewState["VSDropDownData"]; }
            set { ViewState["VSDropDownData"] = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                FIllDropDown();
            
            }

        }



        private void FIllDropDown()
        {
            List<dropdowndata> ddlDataList = new List<dropdowndata>();
            DropDownData d0 = new DropDownData();
            d0.id = 0;
            d0.name = "Select an Item";
            DropDownData d1 = new DropDownData();
            d1.id = 1;
            d1.name = "ABC";
            DropDownData d2 = new DropDownData();
            d2.id = 2;
            d2.name = "DEF";
            DropDownData d3 = new DropDownData();
            d3.id = 3;
            d3.name = "GHI";
            DropDownData d4 = new DropDownData();
            d4.id = 4;
            d4.name = "JKL";
            DropDownData d5 = new DropDownData();
            d5.id = 5;
            d5.name = "MNO";

            ddlDataList.Add(d0);
            ddlDataList.Add(d1);
            ddlDataList.Add(d2);
            ddlDataList.Add(d3);
            ddlDataList.Add(d4);
            ddlDataList.Add(d5);

            VSDropDownData = ddlDataList;

           // DropDownList1.DataValueField = "id";
            DropDownList1.DataTextField = "name";
            DropDownList1.DataSource = VSDropDownData;
            DropDownList1.DataBind();
        }
       

       

        protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
        {
            if (DropDownList1.SelectedIndex > 0)
            {
                ListBox1.Items.Add(DropDownList1.SelectedItem.ToString());
                DropDownList1.Items.Remove(DropDownList1.SelectedItem);
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (ListBox1.SelectedIndex >= 0)
            {
                DropDownList1.Items.Add(ListBox1.SelectedItem.ToString());
                ListBox1.Items.Remove(ListBox1.SelectedItem);
            }
        }
</dropdowndata></dropdowndata></dropdowndata></dropdowndata>


I have used a simple List to fill drop down and I used a class..

C#
[Serializable]
    public class DropDownData
    {

        public int id { get; set; }
        public string name { get; set; }
    }


And here I used an Update Panel with Script Manger to handle the Post Back
ASP.NET
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        Welcome to ASP.NET!
    </h2>
    <p>
      
    <p>
         
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" >
      <ContentTemplate>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" onselectedindexchanged="DropDownList1_SelectedIndexChanged1" 
           >
        </asp:DropDownList>

        
        <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
          </ContentTemplate>
          </asp:UpdatePanel>
    </p>
</asp:Content>
   
v3
Comments
Christian Graus 20-Jan-14 23:30pm
   
Update your question, don't hit 'answer' to ask questions or add detail
tarzanbappa 20-Jan-14 23:35pm
   
this is not the question
Christian Graus 20-Jan-14 23:37pm
   
Oh, it's an answer ? I missed that. In that case, it's just a bad answer. Why would you use update panels to do something as simple as copying values between controls ? Why would you have a postback occur for something so simple ?
tarzanbappa 20-Jan-14 23:42pm
   
OK..So please provide a correct answer to him
Christian Graus 20-Jan-14 23:45pm
   
When he asks a real question, I will. I can't do anything without seeing what his code is. If I wrote a full sample, he'd just complain he couldn't copy and paste it. It's because I am watching and waiting to help more, that I noticed your post and responded to it.
Karthik_Mahalingam 21-Jan-14 0:04am
   
5!
works fine..
This sounds to me like you found two samples you did not understand and could not change them to suit your needs. Are you using jquery ? if not, you should. Either way, post what you've done and we can help fix it.

Sorry - someone posted a crazy answer to your unclear question. Please provide more detail so we can help more.
   
v3
Couldn't see how to attach a file, so had to put the source code here. The comments are my vain attempts to get this working.


Partial Public Class SuppliedFile
Inherits System.Web.UI.Page

'Dim sqlCon As New SqlClient.SqlConnection
'Dim sqlAdp As New SqlClient.SqlDataAdapter
'Dim sqlCmd As New SqlClient.SqlCommand
Dim sqldr As SqlClient.SqlDataReader
'Dim ds As New DataSet() , ds2 As New DataSet(), ds3 As New DataSet(), ds4 As New DataSet()
Dim dView As New DataView()

'Dim ConnectionString As String
'Cannot use data table as BindingSource object doesn't exist in web forms
'Therefore I can't filter
'Can't use dataset table as I can't filter
'Microsoft article on datagridview http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/gridviewex.asp
Dim ListOfFiles As String, ListCt As Integer, ListboxCt As String
Dim AlreadyInListBox As Boolean
Dim ExtraFilters As String
Dim ProcessGroupCode As String, FileTypeCode As String
Dim SortExpression As String, SortString As String
Private Property GridSortExp() As String
Get
If ViewState("GridSortExp") Is Nothing Then
ViewState("GridSortExp") = sortExpression
End If
Return DirectCast(ViewState("GridSortExp"), String)
End Get
Set(ByVal value As String)
ViewState("GridSortExp") = value
End Set
End Property
Private Property GridSortDir() As SortDirection
Get
If ViewState("GridSortDir") Is Nothing Then
ViewState("GridSortDir") = SortDirection.Ascending
End If
Return CType(ViewState("GridSortDir"), SortDirection)
End Get
Set(ByVal value As SortDirection)
ViewState("GridSortDir") = value
End Set
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


If Not IsPostBack Then
Call PopulateComboBoxes()
End If

Call RepopulateListboxes(lstFileTypeCode, hidFileTypeCode)
End Sub
Sub RepopulateListboxes(ByVal Dropdownlist1, ByVal ddlElements)
If IsPostBack Then
Dropdownlist1.Items.Clear()
Dim DropDownListArray As String() = ddlElements.Value.Trim().Split(";"c)

Dim i As Integer = 0
While i < DropDownListArray.Length
Dim itemText As String = DropDownListArray(i)
Dropdownlist1.Items.Add(New ListItem(itemText))
i = i + 1
'Dim itemValue As String = DropDownListArray(i + 1)
'Dropdownlist1.Items.Add(New ListItem(itemText, itemValue))
'i = i + 2

End While
End If

Dim optionsList As String = String.Empty
For i As Integer = 0 To Dropdownlist1.Items.Count - 1
Dim optionText As String = Dropdownlist1.Items(i).Text
Dim optionValue As String = Dropdownlist1.Items(i).Value

If optionsList.Length > 0 Then

optionsList += ";"
End If
optionsList += optionText
optionsList += ";"c
optionsList += optionValue
Next

ddlElements.Value = optionsList
End Sub

Sub PopulateComboBoxes()

'Call LoginToApp()


Using sqlcon As New SqlClient.SqlConnection
Using sqlcmd As New SqlClient.SqlCommand
'Call LoginToApp() - can't use application role here as we need permission settings for individual users
Using sqladp As New SqlClient.SqlDataAdapter
Using dt As New DataTable
Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlcon
sqlcon.ConnectionString = ConnectionString
sqlcon.Open()
sqlcmd.CommandTimeout = 0
sqladp.SelectCommand = sqlcmd

If cmbStatusCode.Items.Count = 0 Then
sqlcmd.Parameters.Clear()
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.Parameters.AddWithValue("Step", 8)
sqlcmd.CommandType = CommandType.StoredProcedure
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbStatusCode.Items.Add("Choose")
cmbStatusCode.DataSource = dt
cmbStatusCode.DataValueField = "StatusCode"
cmbStatusCode.DataTextField = "StatusCode"
cmbStatusCode.DataBind()


cmbstatus2.Items.Clear()
cmbstatus2.Items.Add("Choose")
cmbstatus2.Items.Add("Processing")
cmbstatus2.Items.Add("Queued")

sqlcmd.Parameters.Clear()
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.Parameters.AddWithValue("Step", 9)
sqlcmd.CommandType = CommandType.StoredProcedure
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbFileNameCode.Items.Add("Choose")
cmbFileNameCode.DataSource = dt
cmbFileNameCode.DataValueField = "FileNameCode"
cmbFileNameCode.DataTextField = "FileNameCode"
cmbFileNameCode.DataBind()


'CheckBoxList1.DataSource = dt
'CheckBoxList1.DataValueField = "FileNameCode"
'CheckBoxList1.DataTextField = "FileNameCode"
'CheckBoxList1.DataBind()

sqlcmd.Parameters.Clear()
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.Parameters.AddWithValue("Step", 4)
sqlcmd.CommandType = CommandType.StoredProcedure
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbFileTypeCode.Items.Add("Choose")
cmbFileTypeCode.DataSource = dt
cmbFileTypeCode.DataValueField = "FiletypeCode"
cmbFileTypeCode.DataTextField = "FiletypeCode"
cmbFileTypeCode.DataBind()

sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("Step", 12)
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbMaintDate.Items.Add("Choose")
cmbMaintDate.DataValueField = "MaintDate"
cmbMaintDate.DataTextField = "MaintDate"
cmbMaintDate.DataSource = dt
cmbMaintDate.DataBind()


sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("Step", 14)
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbFileDate.Items.Add("Choose")
cmbFileDate.DataValueField = "fileDate"
cmbFileDate.DataTextField = "fileDate"
cmbFileDate.DataSource = dt
cmbFileDate.DataBind()

sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("Step", 14)
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbFileDate2.Items.Add("Choose")
cmbFileDate2.DataValueField = "fileDate"
cmbFileDate2.DataTextField = "fileDate"
cmbFileDate2.DataSource = dt
cmbFileDate2.DataBind()

sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("Step", 15)
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbProcessGroupCode.Items.Add("Choose")
cmbProcessGroupCode.DataValueField = "ProcessGroupCode"
cmbProcessGroupCode.DataTextField = "ProcessGroupCode"
cmbProcessGroupCode.DataSource = dt
cmbProcessGroupCode.DataBind()

sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("Step", 16)
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbFileGroupDesc.Items.Add("Choose")
cmbFileGroupDesc.DataValueField = "FileGroupDesc"
cmbFileGroupDesc.DataTextField = "FileGroupDesc"
cmbFileGroupDesc.DataSource = dt
cmbFileGroupDesc.DataBind()

sqlcmd.Parameters.Clear()
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.Parameters.AddWithValue("Step", 11)
sqlcmd.CommandType = CommandType.StoredProcedure
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbwarningCode.Items.Add("Choose")
cmbwarningCode.DataSource = dt
cmbwarningCode.DataValueField = "warningCode"
cmbwarningCode.DataTextField = "warningCode"
cmbwarningCode.DataBind()

sqlcmd.Parameters.Clear()
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxes"
sqlcmd.Parameters.AddWithValue("Step", 5)
sqlcmd.CommandType = CommandType.StoredProcedure
sqladp.SelectCommand = sqlcmd
dt.Clear()
dt.Columns.Clear()
sqladp.Fill(dt)
cmbRTRFileContentTypeCode.Items.Add("Choose")
cmbRTRFileContentTypeCode.DataSource = dt
cmbRTRFileContentTypeCode.DataValueField = "rtrinstrumentTypeCode"
cmbRTRFileContentTypeCode.DataTextField = "rtrinstrumentTypeCode"
cmbRTRFileContentTypeCode.DataBind()


End If
End Using
End Using
End Using
End Using


lblErrs.Text = ""
End Sub
Protected Sub PopulateGrids()
'Call LoginToApp()
Using sqlcon As New SqlClient.SqlConnection
Using sqlcmd As New SqlClient.SqlCommand
'Call LoginToApp() - can't use application role here as we need permission settings for individual users
Using sqladp As New SqlClient.SqlDataAdapter
Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlcon
sqlcon.ConnectionString = ConnectionString
sqlcon.Open()
sqlcmd.CommandTimeout = 0
sqladp.SelectCommand = sqlcmd

sqlcmd.Parameters.Clear()
'If Trim(ExtraFilters) <> "" Then
sqlcmd.Parameters.AddWithValue("@ExtraFilters", ExtraFilters)
'End If
sqlcmd.CommandText = "FileCollectionSystemSuppliedFileFormOnline"
sqlcmd.CommandType = CommandType.StoredProcedure

Try
sqldr = sqlcmd.ExecuteReader
GridView1.DataSource = sqldr
GridView1.DataBind()
sqldr.Close()
GridView1.RowStyle.Wrap = False
Catch ex As SqlClient.SqlException
lblErrs.Text = "SQL Error. " & ex.Number & ": " & ex.Message & ": Extra filters = " & ExtraFilters
Exit Sub
Catch ex As Exception
lblErrs.Text = "Non SQL Error. " & ex.Message
Exit Sub
End Try
'''''


'''''''

lblRowCount.Text = GridView1.Rows.Count

End Using
End Using
End Using

lblErrs.Text = ""
End Sub
Protected Sub PopulateGridsForSorting()
'Since this uses dataset rather than datareader it is slower and less robust


Call ApplyFilters(False)
If ExtraFilters = "" Then
lblErrs.Text = "Please filter before sorting grid. Entire grid is too big."
Exit Sub
End If
Using sqlcon As New SqlClient.SqlConnection
Using sqlcmd As New SqlClient.SqlCommand
'Call LoginToApp() - can't use application role here as we need permission settings for individual users
Using sqladp As New SqlClient.SqlDataAdapter
Using ds As New DataSet
Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlcon
sqlcon.ConnectionString = ConnectionString
sqlcon.Open()
sqlcmd.CommandTimeout = 0
sqladp.SelectCommand = sqlcmd

sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("@ExtraFilters", ExtraFilters)
sqlcmd.CommandText = "FileCollectionSystemSuppliedFileFormOnline"
sqlcmd.CommandType = CommandType.StoredProcedure

sqladp.Fill(ds, "GridFill")
ViewState("GridFill") = ds
If GridSortDir = SortDirection.Ascending Then
SortString = GridSortExp & " ASC"
Else
SortString = GridSortExp & " DESC"
End If
If GridSortExp = "" Then
ds.Tables("GridFill").DefaultView.Sort = GridSortExp
Else
ds.Tables("GridFill").DefaultView.Sort = SortString
End If
ViewState("GridFill") = ds
GridView1.SelectedIndex = -1
GridView1.DataSource = ds.Tables("GridFill").DefaultView

GridView1.DataBind()

lblRowCount.Text = GridView1.Rows.Count

End Using
End Using
End Using
End Using

lblErrs.Text = ""
End Sub
Sub cmdShowAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdShowAll.Click
Call PopulateGrids()
End Sub

Sub cmdRefresh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click
Call PopulateGrids()
Call ApplyFilters(True)

End Sub
Protected Sub cmdFilters_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFilters.Click
'I wanted to disable or even make invisible these buttons in the Javascript
'but the program wouldn't work

Call ApplyFilters(True)

End Sub


Sub PopulateListBoxesFromHiddenFields(ByVal ListBox As ListBox, ByVal HiddenField As HiddenField)
'Sub PopulateListBoxesFromHiddenFields(ByVal ListBox As ListBox, ByVal TextBox As TextBox)
Dim Arytest() As String
Dim Counter As Integer

Arytest = Split(Request.Form(HiddenField.Value), ",")
HiddenField.Value = ""

'If HiddenField.ID <> hid Then
For Counter = 0 To UBound(Arytest)
If Arytest(Counter) = "Queued" Then
ListBox.Items.Add("CONX")
ListBox.Items.Add("NPRX")
ListBox.Items.Add("PRIX")
ListBox.Items.Add("RGSX")

ElseIf Arytest(Counter) = "Processing" Then
ListBox.Items.Add("CONS")
ListBox.Items.Add("NPRS")
ListBox.Items.Add("PRIS")
ListBox.Items.Add("RGSS")
'ElseIf ListBox.ID = lstFileDate Or ListBox.ID = lstFileDate2 Then

ElseIf Arytest(Counter).Trim <> String.Empty Then
ListBox.Items.Add(Arytest(Counter))
End If

Next

End Sub
Sub PopulateHiddenFieldsFromListBoxes(ByVal ListBox As ListBox, ByVal HiddenField As HiddenField)
HiddenField.Value = ""
If ListBox.Items.Count > 0 Then
For ListCt = 0 To ListBox.Items.Count - 1
HiddenField.Value = HiddenField.Value & ListBox.Items(ListCt).Text & ","
Next
'remove the last comma
HiddenField.Value = HiddenField.Value.Substring(0, HiddenField.Value.Length - 1)
End If
End Sub
Sub ApplyFilters(ByVal buttonPressed As Boolean)


If buttonPressed = True Then


Call PopulateListBoxesFromHiddenFields(lstFileNameCode, hidFileNameCode)
Call PopulateListBoxesFromHiddenFields(lstFileTypeCode, hidFileTypeCode)
Call PopulateListBoxesFromHiddenFields(lstRtrInstrumentTypeCode, hidrtrInstrumentTypeCode)
Call PopulateListBoxesFromHiddenFields(lstStatusCode, hidStatusCode)
Call PopulateListBoxesFromHiddenFields(lstWarningCode, hidWarningCode)

Call PopulateListBoxesFromHiddenFields(lstFileDate, hidFileDate)
Call PopulateListBoxesFromHiddenFields(lstFileDate2, hidFileDate2)
Call PopulateListBoxesFromHiddenFields(lstMaintdate, hidMaintDate)
Call PopulateListBoxesFromHiddenFields(lstFileGroupDesc, hidFileGroupDesc)
Call PopulateListBoxesFromHiddenFields(lstProcessGroupCode, hidProcessGroupCode)


End If
ExtraFilters = ""
'dView2.RowFilter = ""

If lstStatusCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else
ListOfFiles = ""
ListboxCt = ""
'For Each item In lstStatusCode.Items
For ListCt = 0 To lstStatusCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstStatusCode.Items(ListCt).Text & "',"
Next
'ListOfFiles = Replace(ListOfFiles, "Queued", "'CONX','NPRX','PRIX','RGSX'")
'ListOfFiles = Replace(ListOfFiles, "Processing", "'CONS','NPRS','PRIS','RGSS'")


ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "statusCode in (" & ListOfFiles & ")"
Else
ExtraFilters = ExtraFilters & " AND statusCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters
If lstFileNameCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else
ListOfFiles = ""
ListboxCt = ""
For ListCt = 0 To lstFileNameCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstFileNameCode.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "sf.filenameCode in (" & ListOfFiles & ")"
Else
ExtraFilters = ExtraFilters & " AND sf.filenameCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters
If lstFileTypeCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else
ListOfFiles = ""
ListboxCt = ""
For ListCt = 0 To lstFileTypeCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstFileTypeCode.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "sf.filetypeCode in (" & ListOfFiles & ")"
Else
ExtraFilters = ExtraFilters & " AND sf.filetypeCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters
If lstRtrInstrumentTypeCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else

ListOfFiles = ""
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstRtrInstrumentTypeCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstRtrInstrumentTypeCode.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "RtrInstrumentTypeCode in (" & ListOfFiles & ")"

Else
ExtraFilters = ExtraFilters & " AND RtrInstrumentTypeCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters

If lstWarningCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else

ListOfFiles = ""
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstWarningCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstWarningCode.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "WarningCode in (" & ListOfFiles & ")"

Else
ExtraFilters = ExtraFilters & " AND WarningCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters

If lstProcessGroupCode.Items.Count = 0 Then
'Source1F2.Filter = ""
Else

ListOfFiles = ""
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstProcessGroupCode.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstProcessGroupCode.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "ProcessGroupCode in (" & ListOfFiles & ")"

Else
ExtraFilters = ExtraFilters & " AND ProcessGroupCode in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters

If lstFileGroupDesc.Items.Count = 0 Then
'Source1F2.Filter = ""
Else

ListOfFiles = ""
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstFileGroupDesc.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstFileGroupDesc.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "FileGroupDesc in (" & ListOfFiles & ")"

Else
ExtraFilters = ExtraFilters & " AND FileGroupDesc in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters


If lstMaintdate.Items.Count = 0 Then
'Source1F2.Filter = ""
Else

ListOfFiles = ""
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstMaintdate.Items.Count - 1
ListOfFiles = ListOfFiles & "'" & lstMaintdate.Items(ListCt).Text & "',"
Next
ListOfFiles = Microsoft.VisualBasic.Left(ListOfFiles, Len(ListOfFiles) - 1)
If ExtraFilters = "" Then
ExtraFilters = "RtrMaintdate in (" & ListOfFiles & ")"

Else
ExtraFilters = ExtraFilters & " AND RtrMaintdate in (" & ListOfFiles & ")"
End If
End If
'TxtExpert.Text = ExtraFilters

Dim FileStartDate As String = "", FileEndDate As String = ""
If lstFileDate.Items.Count = 0 And lstFileDate2.Items.Count = 0 Then
'extrafilters = ""
ElseIf lstFileDate.Items.Count > 1 Or lstFileDate2.Items.Count > 1 Then
lblErrs.Text = "File start date and end date can only have one date"
Exit Sub
ElseIf lstFileDate.Items.Count = 1 And lstFileDate2.Items.Count = 0 Then
lblErrs.Text = "select file end date with the file start date"
Exit Sub
ElseIf lstFileDate.Items.Count = 0 And lstFileDate2.Items.Count = 1 Then
lblErrs.Text = "select file start date with the file end date"
Exit Sub

Else
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstFileDate.Items.Count - 1
FileStartDate = lstFileDate.Items(ListCt).Text
Next
ListCt = 0
ListboxCt = ""
For ListCt = 0 To lstFileDate2.Items.Count - 1
FileEndDate = lstFileDate2.Items(ListCt).Text
Next

If Val(FileEndDate) >= Val(FileStartDate) Then
If ExtraFilters = "" Then
ExtraFilters = "filedate >= " & FileStartDate & " AND filedate <= " & FileEndDate
Else
ExtraFilters = ExtraFilters & " AND filedate >= " & FileStartDate & " AND filedate <= " & FileEndDate
End If

Else
lblErrs.Text = "Warning. Start date after end date, presumably for year end."
If ExtraFilters = "" Then
ExtraFilters = "(filedate <= " & FileStartDate & " or filedate >= " & FileEndDate & ") AND (filedate >= " & FileStartDate & " or filedate <= " & FileEndDate & ")"
Else
ExtraFilters = ExtraFilters & " AND (filedate <= " & FileStartDate & " or filedate >= " & FileEndDate & ") AND (filedate >= " & FileStartDate & " or filedate <= " & FileEndDate & ")"
End If
End If


End If
If ExtraFilters = "" Then
lblErrs.Text = "No filters chosen. Entire grid too large to display"
Exit Sub
End If
Call PopulateGrids()
Call PopulateHiddenFieldsFromListBoxes(lstFileNameCode, hidFileNameCode)
Call PopulateHiddenFieldsFromListBoxes(lstFileTypeCode, hidFileTypeCode)
Call PopulateHiddenFieldsFromListBoxes(lstRtrInstrumentTypeCode, hidrtrInstrumentTypeCode)
Call PopulateHiddenFieldsFromListBoxes(lstStatusCode, hidStatusCode)
Call PopulateHiddenFieldsFromListBoxes(lstWarningCode, hidWarningCode)

Call PopulateHiddenFieldsFromListBoxes(lstFileDate, hidFileDate)
Call PopulateHiddenFieldsFromListBoxes(lstFileDate2, hidFileDate2)
Call PopulateHiddenFieldsFromListBoxes(lstMaintdate, hidMaintDate)
Call PopulateHiddenFieldsFromListBoxes(lstFileGroupDesc, hidFileGroupDesc)
Call PopulateHiddenFieldsFromListBoxes(lstProcessGroupCode, hidProcessGroupCode)

End Sub
Protected Sub cmbstatus_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStatusCode.SelectedIndexChanged
'If lstStatusCode.Text = "" Then
' lstStatusCode.Text = "'" & cmbStatusCode.Text & "'"
'Else
' lstStatusCode.Text = lstStatusCode.Text & ",'" & cmbStatusCode.Text & "'"
'End If
If cmbStatusCode.Text <> "Choose" Then
lstStatusCode.Items.Add(cmbStatusCode.Text)
End If
End Sub
Protected Sub cmbstatus2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbstatus2.SelectedIndexChanged
If lstStatusCode.Text = "" Then
'lstStatusCode.Text = "'CONX','NPRX','PRIX','RGSX'"
lstStatusCode.Items.Add("CONX")
lstStatusCode.Items.Add("NPRX")
lstStatusCode.Items.Add("PRIX")
lstStatusCode.Items.Add("RGSX")
Else
'lstStatusCode.Text = "'CONS','NPRS','PRIS','RGSS'"
lstStatusCode.Items.Add("CONS")
lstStatusCode.Items.Add("NPRS")
lstStatusCode.Items.Add("PRIS")
lstStatusCode.Items.Add("RGSS")

End If
End Sub



Protected Sub cmbfiletype_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbFileTypeCode.SelectedIndexChanged
'If cmbFileTypeCode.Text <> "Choose" Then
' lstFileTypeCode.Items.Add(cmbFileTypeCode.Text)
'End If
End Sub




Protected Sub cmbRtrInstrumentType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbRTRFileContentTypeCode.SelectedIndexChanged
If cmbRTRFileContentTypeCode.Text <> "Choose" Then
lstRtrInstrumentTypeCode.Items.Add(cmbRTRFileContentTypeCode.Text)
End If
End Sub

Protected Sub cmbFileDate_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbFileDate.SelectedIndexChanged

End Sub

Protected Sub cmbFileDate2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbFileDate2.SelectedIndexChanged

End Sub
Protected Sub cmbMaintDate_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cmbMaintDate.SelectedIndexChanged

End Sub

Private Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
'GridView1.PageIndex = e.NewPageIndex
'GridView1.DataBind()

End Sub

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
' apply custom formatting to data cells
If e.Row.RowType = DataControlRowType.DataRow Then

Dim cell As TableCell = e.Row.Cells(0)

For i As Integer = 0 To e.Row.Cells.Count - 1
cell = e.Row.Cells(i)
cell.Wrap = False
cell.BorderWidth = 5

Next
End If


End Sub

Private Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim row As GridViewRow = GridView1.SelectedRow
If row.Cells.Count > 13 Then
Panel1.Height = 400
txtSuppliedFileID.Text = row.Cells(18).Text.Replace(" ", "")
'txtFileTypeCode.Text = row.Cells(6).Text.Replace(" ", "")
Server.Transfer("../ChangeData/SuppliedFileChange.aspx")
Else
Panel1.Height = 200
Panel2.Height = 200
ProcessGroupCode = row.Cells(1).Text.Replace(" ", "")
FileTypeCode = row.Cells(2).Text.Replace(" ", "")
'Call LoginToApp()
Using sqlcon As New SqlClient.SqlConnection
Using sqlcmd As New SqlClient.SqlCommand
'Call LoginToApp() - can't use application role here as we need permission settings for individual users
Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlcon
sqlcon.ConnectionString = ConnectionString
sqlcon.Open()
sqlcmd.CommandTimeout = 0


sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("@Step", 2)
sqlcmd.Parameters.AddWithValue("@ProcessGroupCode", ProcessGroupCode)
sqlcmd.Parameters.AddWithValue("@FileTypeCode", FileTypeCode)

If Hour(Now) < 6 Then
sqlcmd.Parameters.AddWithValue("@FileDate", Format(DateAdd(DateInterval.Day, -1, Today), "mmdd"))
Else
sqlcmd.Parameters.AddWithValue("@FileDate", Format(Today, "MMdd"))
End If
sqlcmd.CommandText = "FileCollectionProcessCodeStatus"
sqlcmd.CommandType = CommandType.StoredProcedure
Try
sqldr = sqlcmd.ExecuteReader
GridView2.DataSource = sqldr
GridView2.DataBind()
sqldr.Close()
GridView2.RowStyle.Wrap = False
Catch ex As SqlClient.SqlException
lblErrs.Text = "SQL Error. " & ex.Number & ": " & ex.Message
Exit Sub
Catch ex As Exception
lblErrs.Text = "Non SQL Error. " & ex.Message
Exit Sub
End Try
End Using
End Using

End If
End Sub
Public ReadOnly Property SuppliedFileID() As String
Get
Return txtSuppliedFileID.Text
End Get
End Property



'End Sub

Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
lblErrs.Text = ""
If GridView1.Rows.Count > 500 Then
lblErrs.Text = "The grid has " & GridView1.Rows.Count & " rows. That number must fall to 500 or less to allow sorting"
Return
Else
SortExpression = e.SortExpression
If SortExpression = GridSortExp Then
If GridSortDir = SortDirection.Ascending Then

GridSortDir = SortDirection.Descending
Else
GridSortDir = SortDirection.Ascending
End If
Else
GridSortDir = SortDirection.Ascending
End If
GridSortExp = SortExpression
PopulateGridsForSorting()
End If
End Sub


Protected Sub lstStatus_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStatusCode.TextChanged

End Sub

Protected Sub lstFileName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstFileNameCode.SelectedIndexChanged

End Sub



Protected Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
lstStatusCode.Items.Clear()
lstFileNameCode.Items.Clear()
lstRtrInstrumentTypeCode.Items.Clear()
lstFileTypeCode.Items.Clear()
lstWarningCode.Items.Clear()
lstMaintdate.Items.Clear()
lstFileDate.Items.Clear()
lstFileDate2.Items.Clear()
lstFileGroupDesc.Items.Clear()
lstProcessGroupCode.Items.Clear()
cmbStatusCode.Text = "Choose"
cmbstatus2.Text = "Choose"
cmbFileNameCode.Text = "Choose"
cmbRTRFileContentTypeCode.Text = "Choose"
cmbFileTypeCode.Text = "Choose"
cmbwarningCode.Text = "Choose"
cmbMaintDate.Text = "Choose"
cmbFileDate.Text = "Choose"
cmbFileDate2.Text = "Choose"
cmbProcessGroupCode.Text = "Choose"
cmbFileGroupDesc.Text = "Choose"

txtStatusCode.Text = ""
txtFileDate.Text = ""
txtFileDate2.Text = ""
txtFileNameCode.Text = ""
txtFileTypeCode.Text = ""
txtMaintDate.Text = ""
txtFileGroupDesc.Text = ""
txtProcessGroupCode.Text = ""
txtrtrInstrumentTypeCode.Text = ""
txtWarningCode.Text = ""

hidStatusCode.Value = ""
hidFileDate.Value = ""
hidFileDate2.Value = ""
hidFileNameCode.Value = ""
hidFileTypeCode.Value = ""
hidMaintDate.Value = ""
hidFileGroupDesc.Value = ""
hidProcessGroupCode.Value = ""
hidrtrInstrumentTypeCode.Value = ""
hidWarningCode.Value = ""


End Sub







Sub cmdStatus_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdStatus.Click
'Call LoginToApp()
Using sqlcon As New SqlClient.SqlConnection
Using sqlcmd As New SqlClient.SqlCommand
'Call LoginToApp() - can't use application role here as we need permission settings for individual users
Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlcon
sqlcon.ConnectionString = ConnectionString
sqlcon.Open()
sqlcmd.CommandTimeout = 0

sqlcmd.Parameters.Clear()

sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("@Step", 1)

If Hour(Now) < 6 Then
sqlcmd.Parameters.AddWithValue("@FileDate", Format(DateAdd(DateInterval.Day, -1, Today), "mmdd"))
Else
sqlcmd.Parameters.AddWithValue("@FileDate", Format(Today, "MMdd"))
End If
sqlcmd.CommandText = "FileCollectionProcessCodeStatus"
sqlcmd.CommandType = CommandType.StoredProcedure
Try
sqldr = sqlcmd.ExecuteReader
GridView1.DataSource = sqldr
GridView1.DataBind()
sqldr.Close()
GridView1.RowStyle.Wrap = False
Catch ex As SqlClient.SqlException
lblErrs.Text = "SQL Error. " & ex.Number & ": " & ex.Message
Exit Sub
Catch ex As Exception
lblErrs.Text = "Non SQL Error. " & ex.Message
Exit Sub
End Try
End Using
End Using

End Sub
<system.web.services.webmethodattribute(),> _
Public Shared Function GetFileNameCodes(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As String()


Using sqlCon As New SqlClient.SqlConnection()
Using sqlcmd As New SqlClient.SqlCommand()
Dim connectionString As String = ConfigurationManager.ConnectionStrings("DS2DSConnectionString").ConnectionString
sqlcmd.Connection = sqlCon
sqlCon.ConnectionString = connectionString
sqlCon.Open()
sqlcmd.CommandTimeout = 0
sqlcmd.CommandType = CommandType.StoredProcedure
sqlcmd.Parameters.Clear()
sqlcmd.Parameters.AddWithValue("@Step", 1)
sqlcmd.Parameters.AddWithValue("@EnteredValue", prefixText)
sqlcmd.CommandText = "FileCollectionPopulateDropDownBoxesAutoExtender"
Dim oReader As SqlClient.SqlDataReader
Dim CompletionSet As New List(Of String)()
oReader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection)
While oReader.Read()
CompletionSet.Add(oReader("FileNameCode").ToString())
End While
Return CompletionSet.ToArray()
End Using
End Using


End Function





End Class

---------------------------------------------------------------------------------------------------------------------

]]>

]]>
<asp:content id="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1" xmlns:asp="#unknown">
<asp:toolkitscriptmanager id="ToolkitScriptManager1" runat="server">



//stop enter button from submitting the form. Problem arose when people clicked on dropdownbox item
//to add to listbox and form got submitted and entire grid was displayed.
function stopRKey(evt)
{
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
//if ((evt.keyCode == 13) && (node.type == "text"))
if (evt.keyCode == 13)
{
return false;
}
}
document.onkeypress = stopRKey;
function removeItem(ListboxName,HiddenFieldName)
{
var dropDownListRef = document.getElementById(ListboxName);
var optionsList = '';

if ( dropDownListRef.value.length &gt; 0 )
{
var itemIndex = dropDownListRef.selectedIndex;
if ( itemIndex &gt;= 0 )
dropDownListRef.remove(itemIndex);
}
else
{
alert('Please select an item');
}


for (var i=0; i&lt;dropdownlistref.options.length;&gt;
{
var optionText = dropDownListRef.options[i].text;
var optionValue = dropDownListRef.options[i].value;

if ( optionsList.length &gt; 0 )
optionsList += ';';
optionsList += optionText;
optionsList += ';';
optionsList += optionValue;
}
document.getElementById(HiddenFieldName).value = optionsList;

}

function AddItemFromTextBox(ListboxName,HiddenFieldName,TextboxName)
{

var dropDownListRef = document.getElementById(ListboxName);
var ddlTextRef = document.getElementById(TextboxName);
var ddlValueRef = document.getElementById(TextboxName);
var optionsList = '';

if ( ddlTextRef.value !="" && ddlValueRef.value!="" )
{
var option1 = document.createElement("option");
option1.text= ddlValueRef.value;
option1.value= ddlTextRef.value ;
dropDownListRef.options.add(option1);
}
else
alert('Please enter values');

for (var i=0; i&lt;dropdownlistref.options.length;&gt;
{

var optionText = dropDownListRef.options[i].text;
var optionValue = dropDownListRef.options[i].value;

if ( optionsList.length &gt; 0 )

optionsList += ';';
optionsList += optionText;
optionsList += ';';
optionsList += optionValue;
}
document.getElementById(HiddenFieldName).value = optionsList;

}

function AddItemFromDropDownBox(ListboxName,HiddenFieldName,DropDownboxName)
{
var dropDownListRef = document.getElementById(DropDownboxName);
var ddlTextRef = document.getElementById('ddlText');
var ddlValueRef = document.getElementById('ddlValue');
var optionsList = '';

if ( ddlTextRef.value !="" && ddlValueRef.value!="" )
{
var option1 = document.createElement("option");
option1.text= ddlValueRef.value;
option1.value= ddlTextRef.value ;
dropDownListRef.options.add(option1);
}
else
alert('Please enter values');

for (var i=0; i&lt;dropdownlistref.options.length;&gt;
{

var optionText = dropDownListRef.options[i].text;
var optionValue = dropDownListRef.options[i].value;

if ( optionsList.length &gt; 0 )

optionsList += ';';
optionsList += optionText;
optionsList += ';';
optionsList += optionValue;
}
document.getElementById(HiddenFieldName).value = optionsList;

}



function MoveItem(ctrlSource, ctrlTarget,textboxField,HiddenField) {
var Source = document.getElementById(ctrlSource);
var Target = document.getElementById(ctrlTarget);
var textBox = document.getElementById(textboxField);

if ((Source != null) && (Target != null))
{
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileNameCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileTypeCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtrtrInstrumentTypeCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtStatusCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtWarningCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtMaintDate').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileDate').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileDate2').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtProcessGroupCode').disabled='false';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileGroupDesc').disabled='false';


// while ( Source.options.selectedIndex &gt;= 0 )
// {
var HiddenList = document.getElementById(HiddenField) //The hidden field
var SelectedValue = Source.options[Source.options.selectedIndex].value + ';'; // Hidden List is comma seperated
// if (SelectedValue != "")
// {
// SelectedValue += ",";
// }
var newOption = new Option(); // Create a new instance of ListItem
newOption.text = Source.options[Source.options.selectedIndex].text;
newOption.value = Source.options[Source.options.selectedIndex].value;
if (Source.name =="ctl00$ContentPlaceHolder1$cmbstatus2")
{
SelectedValue=SelectedValue.replace("Processing,","CONS,NPRS,PRIS,RGSS,")
SelectedValue=SelectedValue.replace("Queued,","CONX,NPRX,PRIX,RGSX,")
newOption.text=newOption.text.replace("Processing","CONS,NPRS,PRIS,RGSS")
newOption.text=newOption.text.replace("Queued","CONX,NPRX,PRIX,RGSX")
newOption.value=newOption.value.replace("Processing","CONS,NPRS,PRIS,RGSS")
newOption.value=newOption.value.replace("Queued","CONX,NPRX,PRIX,RGSX")


}

//There can be multilple filenamecodes etc, but only one startdate and one enddate
if (Target.name=="ctl00$ContentPlaceHolder1$lstFileDate")
{
Target.options.length = 0;
textBox.value = '';
HiddenList .value="";
}
if (Target.name=="ctl00$ContentPlaceHolder1$lstFileDate2")
{
Target.options.length = 0;
textBox.value = '';
HiddenList .value="";
}

Target.options[Target.length] = newOption; //Append the item in Target
Source.remove(Source.options.selectedIndex); //Remove the item from Source
if (HiddenList.value.indexOf(SelectedValue) == -1)
{
HiddenList.value += SelectedValue; // Add it to hidden list
textBox.value = HiddenList.value//textBox.value+','+ddl.options[ddl.selectedIndex].text;

}
else
{
HiddenList.value = HiddenList.value.replace(SelectedValue+",",""); // Remove from Hidden List
HiddenList.value = HiddenList.value.replace(SelectedValue,""); // Remove from Hidden List
//textBox.value = HiddenList.value
}
//document.getElementById('ctl00_ContentPlaceHolder1_txtFileNameCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileTypeCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtrtrInstrumentTypeCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtStatusCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtWarningCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtMaintDate').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileDate').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileDate2').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtProcessGroupCode').disabled='true';
// document.getElementById('ctl00_ContentPlaceHolder1_txtFileGroupDesc').disabled='true';

}
}

// function UpdateFileNamecodeFromTextBox(ctrlSource, ctrlTarget,textboxField,HiddenField)
// {
// var Source = document.getElementById(ctrlSource);
// var Target = document.getElementById(ctrlTarget);
// var textBox = document.getElementById(textboxField);
//
// if ((Source != null) && (Target != null))
// {
// var HiddenList = document.getElementById(HiddenField) //The hidden field
// //var SelectedValue = Source.options[Source.options.selectedIndex].value + ','; // Hidden List is comma seperated
// var SelectedValue = Source.value
// if (SelectedValue != "")
// {
// SelectedValue += ",";
// }
// var newOption = new Option(); // Create a new instance of ListItem
// newOption.text = Source.value;
// newOption.value = Source.value;

// //newOption.value = Source.value;
//

// Target.options[Target.length] = newOption ; //Append the item in Target
// //Source.remove(Source.options.selectedIndex); //Remove the item from Source
// Source .value="";
// if (HiddenList.value.indexOf(SelectedValue) == -1)
// {
// HiddenList.value += SelectedValue; // Add it to hidden list
// textBox.value = HiddenList.value//textBox.value+','+ddl.options[ddl.selectedIndex].text;

// }
// else
// {
// HiddenList.value = HiddenList.value.replace(SelectedValue,""); // Remove from Hidden List
// //textBox.value = HiddenList.value
// }
// }
// }
// function MoveItemTextboxOnly(ctrlSource, textboxField,HiddenField)
// {
// var Source = document.getElementById(ctrlSource);
// var textBox = document.getElementById(textboxField);
//
// if ((Source != null) && (textBox.value ==""))
// {
// //while ( Source.options.selectedIndex &gt;= 0 ) {
// var HiddenList = document.getElementById(HiddenField) //The hidden field
// var SelectedValue = Source.options[Source.options.selectedIndex].value //+ ','; Hidden List is comma seperated
// var newOption = new Option(); // Create a new instance of ListItem
// newOption.text = Source.options[Source.options.selectedIndex].text;
// newOption.value = Source.options[Source.options.selectedIndex].value;
//
// Source.remove(Source.options.selectedIndex); //Remove the item from Source
// if (HiddenList.value.indexOf(SelectedValue) == -1)
// {
// HiddenList.value += SelectedValue; // Add it to hidden list
// textBox.value = HiddenList.value//textBox.value+','+ddl.options[ddl.selectedIndex].text;

// }
// else
// {
// HiddenList.value = HiddenList.value.replace(SelectedValue,""); // Remove from Hidden List
// //textBox.value = HiddenList.value
// }
// }
// }


<%--<asp:button id="cmdClearInstrumentType" runat="server" text="Clear">
<asp:button id="cmdClearFileTypeCode" runat="server" text="Clear">

<asp:button id="cmdClearFileNameCode" runat="server" text="Clear">

<asp:button id="cmdClearStatusCode" runat="server" text="Clear">--%>


<asp:label id="lblErrs" runat="server" text="">


<asp:button id="cmdShowAll" runat="server" text="Show All / Refresh" onclick="cmdShowAll_Click">
<asp:button id="cmdRefresh" runat="server" text="Refresh" onclick="cmdRefresh_Click">
<asp:button id="cmdFilters" runat="server" text="ApplyFilters" onclick="cmdFilters_Click">
<asp:button id="cmdClear" runat="server" text="Clear Boxes" width="80px" onclick="cmdClear_Click">
<asp:button id="cmdStatus" runat="server" text="Show File Status" width="80px" onclick="cmdStatus_Click">




<%--


--%>






<%----%>

<%-- --%>


<asp:listbox id="lstStatusCode" runat="server">


<asp:listbox id="lstFileNameCode" runat="server">
<asp:listbox id="lstFileTypeCode" runat="server">
<asp:listbox id="lstWarningCode" runat="server">
<asp:listbox id="lstMaintdate" runat="server">
<asp:listbox id="lstRtrInstrumentTypeCode" runat="server">
<asp:listbox id="lstFileDate" runat="server">
<asp:listbox id="lstFileDate2" runat="server">
<asp:listbox id="lstProcessGroupCode" runat="server">
<asp:listbox id="lstFileGroupDesc" runat="server">


onclick="removeItem('ctl00_ContentPlaceHolder1_lstStatusCode','ctl00_ContentPlaceHolder1_hidStatusCode')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstFileNameCode','ctl00_ContentPlaceHolder1_hidFileNameCode')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstFileTypeCode','ctl00_ContentPlaceHolder1_hidFileTypeCode')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstWarningCode','ctl00_ContentPlaceHolder1_hidWarningCode')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstMaintdate','ctl00_ContentPlaceHolder1_hidMaintDate')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstRtrInstrumentTypeCode','ctl00_ContentPlaceHolder1_hidrtrInstrumentTypeCode')"; />

onclick="removeItem('ctl00_ContentPlaceHolder1_lstFileDate','ctl00_ContentPlaceHolder1_hidFileDate')"; />


onclick="removeItem('ctl00_ContentPlaceHolder1_lstFileDate2','ctl00_ContentPlaceHolder1_hidFileDate2')"; />


onclick="removeItem('ctl00_ContentPlaceHolder1_lstProcessGroupCode','ctl00_ContentPlaceHolder1_hidProcessGroupCode')"; />


onclick="removeItem('ctl00_ContentPlaceHolder1_lstFileGroupDesc','ctl00_ContentPlaceHolder1_hidFileGroupDesc')"; />

<asp:label id="Label1" runat="server" text="StatusCode">


<asp:label id="Label2" runat="server" text="Processing Status">
<asp:label id="Label2" runat="server" text="Processing Status">
<asp:label id="Label10" runat="server" text="File Name">
<asp:label id="Label3" runat="server" text="File Type">
<asp:label id="Label4" runat="server" text="WarningCode">
<asp:label id="Label5" runat="server" text="MaintDate">

<asp:label id="Label6" runat="server" text="Instrument">
<asp:label id="Label7" runat="server" text="FileDateSt">

<asp:label id="Label11" runat="server" text="FileDateEnd">
<asp:label id="Label8" runat="server" text="Process Code">
<asp:label id="Label9" runat="server" text="FileGroupDesc">
<asp:dropdownlist id="cmbStatusCode" runat="server" appenddatabounditems="True">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbStatusCode', 'ctl00_ContentPlaceHolder1_lstStatusCode', 'ctl00_ContentPlaceHolder1_txtStatusCode', 'ctl00_ContentPlaceHolder1_hidStatusCode');"

AutoPostBack="true">



<asp:dropdownlist id="cmbstatus2" runat="server" appenddatabounditems="True">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbstatus2', 'ctl00_ContentPlaceHolder1_lstStatusCode', 'ctl00_ContentPlaceHolder1_txtStatusCode', 'ctl00_ContentPlaceHolder1_hidStatusCode');"
AutoPostBack="false">

<asp:dropdownlist id="cmbFileNameCode" runat="server">
onChange="Javascript:AddItemFromDropDownBox('ctl00_ContentPlaceHolder1_lstFileNameCode','ctl00_ContentPlaceHolder1_hidFileNameCode','ctl00_ContentPlaceHolder1_cmbFileNameCode');"


AppendDataBoundItems="True">

<asp:dropdownlist id="cmbFileTypeCode" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbFileTypeCode', 'ctl00_ContentPlaceHolder1_lstFileTypeCode', 'ctl00_ContentPlaceHolder1_txtFileTypeCode', 'ctl00_ContentPlaceHolder1_hidFileTypeCode');"
AppendDataBoundItems="True" AutoPostBack="True">
<asp:dropdownlist id="cmbwarningCode" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbwarningCode', 'ctl00_ContentPlaceHolder1_lstWarningCode','ctl00_ContentPlaceHolder1_txtWarningCode', 'ctl00_ContentPlaceHolder1_hidWarningCode');"
AppendDataBoundItems="True">

<asp:dropdownlist id="cmbMaintDate" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbMaintDate', 'ctl00_ContentPlaceHolder1_lstMaintdate','ctl00_ContentPlaceHolder1_txtMaintDate', 'ctl00_ContentPlaceHolder1_hidMaintDate');"
AppendDataBoundItems="True">


<asp:dropdownlist id="cmbRTRFileContentTypeCode" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbRTRFileContentTypeCode', 'ctl00_ContentPlaceHolder1_lstRtrInstrumentTypeCode', 'ctl00_ContentPlaceHolder1_txtrtrInstrumentTypeCode', 'ctl00_ContentPlaceHolder1_hidrtrInstrumentTypeCode');"
AppendDataBoundItems="True" AutoPostBack="false">

<asp:dropdownlist id="cmbFileDate" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbFileDate', 'ctl00_ContentPlaceHolder1_lstFileDate', 'ctl00_ContentPlaceHolder1_txtFileDate', 'ctl00_ContentPlaceHolder1_hidFileDate');"
AppendDataBoundItems="True" AutoPostBack="false">



<asp:dropdownlist id="cmbFileDate2" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbFileDate2', 'ctl00_ContentPlaceHolder1_lstFileDate2', 'ctl00_ContentPlaceHolder1_txtFileDate2', 'ctl00_ContentPlaceHolder1_hidFileDate2');"
AppendDataBoundItems="True" AutoPostBack="false">



<asp:dropdownlist id="cmbProcessGroupCode" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbProcessGroupCode', 'ctl00_ContentPlaceHolder1_lstProcessGroupCode', 'ctl00_ContentPlaceHolder1_txtProcessGroupCode', 'ctl00_ContentPlaceHolder1_hidProcessGroupCode');"
AppendDataBoundItems="True" AutoPostBack="false">



<asp:dropdownlist id="cmbFileGroupDesc" runat="server">
onChange="Javascript:MoveItem('ctl00_ContentPlaceHolder1_cmbFileGroupDesc', 'ctl00_ContentPlaceHolder1_lstFileGroupDesc', 'ctl00_ContentPlaceHolder1_txtFileGroupDesc', 'ctl00_ContentPlaceHolder1_hidFileGroupDesc');"
AppendDataBoundItems="True" AutoPostBack="false">




<asp:textbox id="txtFileNameCode2" runat="server">
<asp:autocompleteextender id="AutoCompleteExtender1" runat="server">
TargetControlID ="txtFileNameCode2" UseContextKey="True" ServiceMethod ="GetFileNameCodes"
MinimumPrefixLength="2" CompletionInterval ="100">




onclick="AddItemFromTextBox('ctl00_ContentPlaceHolder1_lstFileNameCode','ctl00_ContentPlaceHolder1_hidFileNameCode','ctl00_ContentPlaceHolder1_txtFileNameCode2')"; />









<asp:textbox id="TxtExpert" runat="server" width="50%">
--%>]]>


<asp:gridview id="GridView1" runat="server">
AllowSorting="True"
Font-Names="Arial"
Font-Size="Small"
RowStyle-Wrap="False"
BackColor="White"
BorderColor="Silver"
AutoGenerateColumns="True" >
<rowstyle wrap="False">
<columns>

<asp:commandfield showselectbutton="True">

<asp:buttonfield text="DoubleClick" commandname="DoubleClick" visible="false">
--%>]]>


<asp:label id="lblRowCount" runat="server" text="">



<asp:textbox id="txtSuppliedFileID" runat="server">



<asp:gridview id="GridView2" runat="server" allowsorting="True">
Font-Names="Arial" Font-Size="Small" RowStyle-Wrap="False"
BackColor="White" BorderColor="Silver" AutoGenerateColumns="True" >
<rowstyle wrap="False">
<columns>
<asp:commandfield showselectbutton="True">




<asp:hiddenfield id="hidFileNameCode" runat="server">
<asp:hiddenfield id="hidFileTypeCode" runat="server">
<asp:hiddenfield id="hidrtrInstrumentTypeCode" runat="server">
<asp:hiddenfield id="hidStatusCode" runat="server">
<asp:hiddenfield id="hidWarningCode" runat="server">
<asp:hiddenfield id="hidMaintDate" runat="server">
<asp:hiddenfield id="hidFileDate" runat="server">
<asp:hiddenfield id="hidFileDate2" runat="server">
<asp:hiddenfield id="hidProcessGroupCode" runat="server">
<asp:hiddenfield id="hidFileGroupDesc" runat="server">


<asp:textbox id="txtFileNameCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtFileTypeCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtrtrInstrumentTypeCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtStatusCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtWarningCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtMaintDate" runat="server" enabled="true" visible="true">
<asp:textbox id="txtFileDate" runat="server" enabled="true" visible="true">
<asp:textbox id="txtFileDate2" runat="server" enabled="true" visible="true">
<asp:textbox id="txtProcessGroupCode" runat="server" enabled="true" visible="true">
<asp:textbox id="txtFileGroupDesc" runat="server" enabled="true" visible="true">

   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900