Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear friends,

i have a two dropdowlist on my webform. 2nd dropdownlist related to first.

when i select first dropdownlist such as (model no) then 2nd dropdownlist get populated with partlist.

It works fine in IE. but failed in mozila.
i am using java script and database on change event.

i have use on pageload

this code


VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       sessionContactID = Session("sessionContactID")

       If sessionContactID > 0 Then
           sessionUserTypeID = Session("sessionUserTypeID")
           sessionLocationID = Session("sessionLocationID")
           sessionLocationTypeID = Session("sessionLocationTypeID")
           ListType = IIf(Session("ListType") IsNot Nothing, Session("ListType"), 0)

           If Not IsPostBack Then

               ddlModels.Attributes.Add("onchange", "return BindSparesCode(this,'" & ddlSpareParts.ClientID & "');")

               ddlModels.DataSource = objDBModels.GetModelNos()
               ddlModels.DataBind()
               ddlSpareParts.DataBind()

               txtDay.Attributes.Add("onkeyup", "return Validate_Date(this,'dd','" & txtMonth.ClientID & "','" & txtYear.ClientID & "');")
               txtMonth.Attributes.Add("onkeyup", "return Validate_Date(this,'mm','" & txtDay.ClientID & "','" & txtYear.ClientID & "');")
               txtYear.Attributes.Add("onkeyup", "return Validate_Date(this,'yyyy','" & txtDay.ClientID & "','" & txtMonth.ClientID & "');")

               optDeliver.Attributes.Add("onclick", "return OptionsRO_Clicked('Deliver','" & tblParts.ClientID & "','" & tblAddParts.ClientID & "','" & btnCreate.ClientID & "')")
               optOrderParts.Attributes.Add("onclick", "return OptionsRO_Clicked('OrderParts','" & tblParts.ClientID & "','" & tblAddParts.ClientID & "','" & btnCreate.ClientID & "')")

               btnCreate.OnClientClick = "return ValidateList('" & tblParts.ClientID & "' ,'" & tblPurchasedlocally.ClientID & "','" & lblErrorMsg.ClientID & "');"

               cmbCreate.OnClientClick = "return ShowConfirmBox('" & pnlConfirmBox.ClientID & "', '" & lblMessage.ClientID & "', '" & hdnAction.ClientID & "');"

               btnNo.Attributes.Add("onclick", "document.getElementById('" & pnlConfirmBox.ClientID & "').style.display = 'none'; return false; ")

               If Session("ControlToLoad") IsNot Nothing Then
                   objCTL = Session("ControlToLoad")
                   If objCTL.ParameterCollection.ContainsKey("OrderNo") Then
                       OrderNo = objCTL.ParameterCollection.Item("OrderNo")
                       hdnOrderNo.Value = OrderNo
                       If objCTL.ParameterCollection.ContainsKey("Action") Then
                           Action = objCTL.ParameterCollection.Item("Action")
                       End If
                   End If
               End If

               tblAddParts.Style.Item("display") = "none"

               If ListType > 0 And Action = String.Empty Then
                   tblAddParts.Style.Item("display") = "block"
               End If

               Select Case ListType

                   Case OrderType.Purchased
                       lblQTy.Text = "Qty"
                       lblHeader.Text = "Purchased (Part List)"
                       tblPurchasedlocally.Style.Item("display") = "block"
                       btnCreate.Text = "Submit"
                       hdnAction.Value = "Purchased_Cannibalize"

                   Case OrderType.Ordered
                       lblQTy.Text = "Ordered"
                       lblHeader.Text = "Order (Part List)"
                       hdnAction.Value = "CreateList"

                   Case OrderType.Delivered
                       txtQty.Attributes.Add("onkeyup", "return LessThanQtyInStock(this,'" & hdnQtyInStock.ClientID & "');")
                       ddlSpareParts.Attributes.Add("onchange", "return QtyInStock(this,'" & hdnQtyInStock.ClientID & "');")
                       lblQTy.Text = "Delivered"
                       lblHeader.Text = "Deliver (Part List)"
                       hdnAction.Value = "CreateList"

                   Case OrderType.Cannibalized
                       lblQTy.Text = "Qty"
                       lblHeader.Text = "Cannibalized (Part List)"
                       btnCreate.Text = "Submit"
                       hdnAction.Value = "Purchased_Cannibalize"

               End Select

               Select Case Action

                   Case "Disable", "Purchased", "Cannibalized"
                       btnCreate.Visible = False

                   Case "ToBeDelivered"
                       btnCreate.Text = "Deliver"
                       hdnAction.Value = "DeliverList"
                       tblDeliveryType.Visible = True

                   Case "ToBeReceived", "Received"
                       If ListType = OrderType.Delivered Then
                           tblReceiveParts.Style.Item("display") = "none"
                           tblParts.Style.Item("display") = "block"

                       Else
                           tblReceiveParts.Style.Item("display") = "block"
                           tblParts.Style.Item("display") = "none"

                       End If
                       btnCreate.Visible = False
                       hdnAction.Value = "ReceiveList"

                   Case "Edit"
                       btnCreate.Text = "Update List"
                       hdnAction.Value = "UpdateList"
                       tblAddParts.Style.Item("display") = "block"

                   Case "Create"
                       btnCreate.Text = "Create List"
                       hdnAction.Value = "CreateList"
                       tblAddParts.Style.Item("display") = "block"

               End Select


               If sessionLocationTypeID = LocationType.RO And Action = "ToBeDelivered" Then
                   divOptions.Style.Item("display") = "block"
                   spanOptionsRO.Style.Item("display") = "block"
               End If

               If Session("ControlToLoad") IsNot Nothing Then
                   Session("PartsList") = objDB.GetInventory_Orders_PartList(OrderNo, sessionLocationID)
                   LoadList()
                   LoadParts()
                   If Action = "Purchased" Or Action = "Cannibalized" Then
                       DisableALL()
                   End If
               Else
                   Session("PartsList") = Nothing
               End If

           End If

           btnAdd.Attributes.Add("onclick", "javascript:return AddRow('" & ddlModels.ClientID & "', '" & ddlSpareParts.ClientID & "', '" & txtQty.ClientID & "',  '" & tblParts.ClientID & "');")

       Else
           Response.Redirect("~/Login.aspx")

       End If
   End Sub



and java script
<---------------------------------------------------------java>

C#
function BindSparesCode(obj, ddl) {
            var objDDL = document.getElementById(ddl);

            if (obj.options(obj.selectedIndex).value != 0) {
                PageMethods.GetSparesCode(obj.options(obj.selectedIndex).value, CallSuccess_SparesCode, CallFailed_SparesCode, objDDL);
            }
            else {
                Remove_InsertDDL(objDDL)
            }
            return false;
        }

        function CallSuccess_SparesCode(res, destCtrl) {
            var strArray = new Array(200);
            strArray = res.split(";");
            var objDDL = destCtrl;

            Remove_InsertDDL(objDDL)
            if (strArray.length > 1) {
                for (i = 0; i < strArray.length; i = i + 2) {
                    var optn = document.createElement("OPTION");
                    objDDL.options.add(optn);
                    optn.text = strArray[i];
                    optn.value = strArray[i + 1];
                }
            }

        }




any hint ?


thanks in advnace
Posted
Updated 27-Jun-11 1:18am
v3

Hi

Please try Z-Index in css Style.
 
Share this answer
 
Have you use AJAX for that ?
can u post your code so that we can help you
 
Share this answer
 
 
Share this answer
 

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