Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dropdown list inside update panel . it works fine on several machines but on specific machines it works on alternate change events.

Example :

Initially it is set to 0 index "Select Serial No"
When i Choose say SrNo1 , change event doesnt fire
When i choose say SrNo2, change event fires
When i Choose say SrNo3 , change event doesnt fire
When i choose say SrNo4, change event fires
and so on...



Code :

C#
protected void ddlCollection_SelectedIndexChanged(object sender, EventArgs e)
      {

          ddlSerial.SelectedIndex = -1;
          hdfQDSID.Value = "";
          txtQuantity.Text = "";
          lblTypeT.Text = "";
          lblQds.Text = "";
          lnkWHStock.Text = "";
          lblPieces.Text = "";
          lblUnit.Text = "";


          string CollectionID = ddlCollection.SelectedValue.ToString();

          if (ddlCollection.SelectedValue.ToString() != "0")
          {

              DataTable dt = new DataTable();
              DataSet ds = objBAL.getGridCollectionSrNo(CollectionID.ToString());

              if (ds.Tables[1].Rows[0]["COLLECTION_STATUS"].ToString() == "DISCONTINUED")
              {
                  ScriptManager.RegisterStartupScript(Page, GetType(), "CollectionDscontiAler", "<script>alert('This Collection has been discontinued.');</script>", false);
              }


              dt = ds.Tables[0];
              ddlSerial.DataSource = dt;
              ddlSerial.DataTextField = "SR_NO";
              ddlSerial.DataValueField = "SR_NO";
              ddlSerial.DataBind();
              ddlSerial.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Sr No", "0"));
              ddlSerial.SelectedIndex = 0;
          }
      }




C#
protected void ddlSerial_SelectedIndexChanged(object sender, EventArgs e)
      {
          hdfQDSID.Value = "";
          txtQuantity.Text = "";
          lblTypeT.Text = "";
          lblQds.Text = "";
          lnkWHStock.Text = "";
          lblPieces.Text = "";
          lblUnit.Text = "";

          string QDSName = string.Empty;
          string QDSID = string.Empty;
          string TypeOfFabric = string.Empty;

          string CollectionID = ddlCollection.SelectedValue.ToString();
          string SrNo = ddlSerial.SelectedValue.ToString();


          if (SrNo != "0" && CollectionID != "0")
          {

              DataTable dt = new DataTable();
              DataSet dsQdsName = objBAL.getGridCollectionQDS(CollectionID, SrNo);  //uspB2BCustomerPortal_uspGetCollectionQDS
              dt = dsQdsName.Tables[0];

              if (dt.Rows.Count > 0)
              {
                  QDSName = dt.Rows[0]["QDSName"].ToString();
                  QDSID = dt.Rows[0]["QDS_ID"].ToString();
                  hdfMultipleOf.Value = dt.Rows[0]["MULTIPLE_OF"].ToString();
                  if (dsQdsName.Tables[1].Rows[0]["PRODUCT_STATUS"].ToString() == "DISCONTINUED")
                  {
                      ScriptManager.RegisterStartupScript(Page, GetType(), "QDSDiscontinuedAlertU", "<script>alert('This QDS has been discontinued.');</script>",true);
                  }

              }

              TypeOfFabric = lblOrderTypeDesription.Text.ToString();
              if (QDSName != "")
              {
                  lblQds.Text = QDSName.ToString();
                  hdfQDSID.Value = QDSID.ToString();

                  //bool result = CheckQDSOrderForCustomer();

                  //if (result)
                  //{


                  if (QDSID != "")
                  {
                      //Code for WHStock & No of Pcs.
                      B2B_Order_Master_SAP_BAL obj_BAL = new B2B_Order_Master_SAP_BAL();
                      DataSet dsWHStockinfo = obj_BAL.getWHStock(QDSID, hfCustomerId.Value.ToString());   //usp_B2BCustomerPortal_getCreateOrderWHStock
                      lnkWHStock.Text = dsWHStockinfo.Tables[0].Rows[0]["WHStock"].ToString();
                      lblPieces.Text = dsWHStockinfo.Tables[0].Rows[0]["No_Of_Pieces"].ToString();

                      //if (dsWHStockinfo.Tables[0].Rows[0]["No_Of_Pieces"].ToString() != "")
                      //{
                      //    lblPieces.ForeColor = System.Drawing.Color.Red;
                      //}
                  }

                  if (TypeOfFabric == "Fabric Order")
                  {
                      lblUnit.Text = "Mtrs.";
                  }
                  else if (TypeOfFabric == "Non-Fabric Order" || TypeOfFabric == "Catalogue Order")
                  {
                      lblUnit.Text = "Pcs";
                  }

                  //}
                  //else
                  //{
                  //    ScriptManager.RegisterStartupScript(Page, GetType(), "Last3DaysTwo2", "<script>AlertUser();</script>", false);
                  //    YesAlertUser.Focus();
                  //}
              }
              else
              {
                  lblQds.Text = "QDS Not Found.";
              }
          }
      }


What I have tried:

My Updatepanel is below :
HTML
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
           <contenttemplate>
</contenttemplate>
           <triggers>
               <asp:AsyncPostBackTrigger ControlID="btnShowInfo" EventName="Click" />
               <asp:AsyncPostBackTrigger ControlID="btnAddItems" EventName="Click" />
               <asp:AsyncPostBackTrigger ControlID="ddlSerial" EventName="SelectedIndexChanged" />
           </triggers>

       <asp:UpdateProgress ID="updPanelProgress" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
           <progresstemplate>
               <div class="pre-loader"></div>
           </progresstemplate>

-- This dropdownlist is causing problem. It is inside a table
HTML
<table><tbody><tr><td>
<asp:DropDownList ID="ddlSerial" runat="server" onchange="SetScroll();" AutoPostBack="true" OnSelectedIndexChanged="ddlSerial_SelectedIndexChanged">

</td></tr></tbody></table>
Posted
Updated 11-Jul-16 3:22am
v4
Comments
Karthik_Mahalingam 11-Jul-16 4:02am    
how you are binding the data?
Abrar Kazi 11-Jul-16 4:40am    
there is another dropdownlist whose selected index change is assigning values to this dropdownlist.
Karthik_Mahalingam 11-Jul-16 4:45am    
ok, cascading drop down ?
post all relevant code.
Abrar Kazi 11-Jul-16 5:28am    
check the updated question
Karthik_Mahalingam 11-Jul-16 6:10am    
which one is parent/child

1 solution

try this

C#
ScriptManager.RegisterClientScriptBlock(this, GetType(), "CollectionDscontiAler", "<script>alert('This Collection has been discontinued.');</script>", false);
 
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