You must Sign In to post a response.
  • Category: .NET

    Drop down gets disappeared on selecting an item from the dropdownlist

    Below is my code which displays a drop down as workstatus and this work status contains number of items like sub,re sub and ra on selecting one of the item in that drop down my entire drop down gets disappered.How ca i display the drop down on selecting any one item in drop down list


    In aspx page


    <table class="auto-style1">
    <tr>
    <td class="auto-style2"> </td>
    <td class="auto-style3">
     </td>
    <td class="auto-style4"> </td>
    <td class="auto-style5">
     </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">PatientID</td>
    <td class="auto-style3">
    <%--<asp:DropDownCheckBoxes ID="DrpPatientID" runat="server" AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;"> <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" /> <Texts SelectBoxCaption="PatientID" /> </asp:DropDownCheckBoxes>--%>
    <asp:TextBox ID ="txtPatientID" runat ="server"></asp:TextBox>


    </td>
    <td class="auto-style4"> </td>
    <td class="auto-style5">
     </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">FileName</td>
    <td class="auto-style3"><asp:DropDownCheckBoxes ID="drpFileName" runat="server" AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;"> <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" /> <Texts SelectBoxCaption="FileName" /> </asp:DropDownCheckBoxes></td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">Clinician</td>
    <td class="auto-style3"><asp:DropDownCheckBoxes ID="drpClinician" runat="server"
    AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;">
    <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" />
    <Texts SelectBoxCaption="Clinician" />
    </asp:DropDownCheckBoxes></td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">SenderID</td>
    <td class="auto-style3"><asp:DropDownCheckBoxes ID="drpSenderID" runat="server"
    AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: -1px; left: 1px; height: 19px;">
    <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" />
    <Texts SelectBoxCaption="SenderID" />
    </asp:DropDownCheckBoxes></td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">ReceiverID</td>
    <td class="auto-style3"><asp:DropDownCheckBoxes ID="drpReceiverID" runat="server"
    AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;">
    <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" />
    <Texts SelectBoxCaption="ReceiverID" /></asp:DropDownCheckBoxes></td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2">Type</td>
    <td class="auto-style3"><asp:DropDownCheckBoxes ID="drpType" runat="server"
    AddJQueryReference="True" UseButtons="True" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;">
    <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" />
    <Texts SelectBoxCaption="Type" /></asp:DropDownCheckBoxes> </td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2"> </td>
    <td class="auto-style3">
    <asp:Button ID="btnGetReport" runat="server" OnClick="btnGetReport_Click" Text="GetReport" />
    <asp:Button ID="btnExport" runat="server" OnClick="Button1_Click" Text="ExportToExcel" />
    </td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    <tr>
    <td class="auto-style2"> </td>
    <td class="auto-style3"> </td>
    <td class="auto-style4"> </td>
    <td class="auto-style5"> </td>
    <td> </td>
    </tr>
    </table>


    in .cs

    Admin adm;
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Session.Count > 0) { if (Session["uid"] != null) lblUser.Text = Session["uid"].ToString(); else Response.Redirect("Login.aspx?i=1"); } else Response.Redirect("Login.aspx?i=1");
    adm = new Admin();
    if (!IsPostBack)
    {
    GetFiles();
    }
    }


    protected void GetFiles()
    {
    DataTable dtfiles = adm.getSubFiles();
    if (dtfiles.Rows.Count > 0)
    {
    drpFileName.DataSource = dtfiles;
    drpFileName.DataTextField = "FileName";
    drpFileName.DataValueField = "FileName";
    drpFileName.DataBind();
    }
    DataTable dtClinician = adm.getClinician();

    if (dtClinician.Rows.Count > 0)
    {
    drpClinician.DataSource = dtClinician;
    drpClinician.DataTextField = "clinician";
    drpClinician.DataValueField = "clinician";
    drpClinician.DataBind();
    }

    DataTable dtSenderId = adm.GetSenderID();

    if (dtSenderId.Rows.Count > 0)
    {
    drpSenderID.DataSource = dtSenderId;
    drpSenderID.DataTextField = "SenderID";
    drpSenderID.DataValueField = "SenderID";
    drpSenderID.DataBind();
    }

    DataTable dtReceiverId = adm.getReceiverID();
    if (dtReceiverId.Rows.Count > 0)
    {
    drpReceiverID.DataSource = dtReceiverId;
    drpReceiverID.DataTextField = "ReceiverID";
    drpReceiverID.DataValueField = "ReceiverID";
    drpReceiverID.DataBind();
    }

    DataTable dtType = adm.getType1();

    if (dtType.Rows.Count > 0)
    {
    drpType.DataSource = dtType;
    drpType.DataTextField = "Type";
    drpType.DataValueField = "Type";
    drpType.DataBind();

    }

    }

    protected void btnGetReport_Click(object sender, EventArgs e)
    {
    GridView1.DataSource = null;
    GridView1.DataBind();

    string SubPatientID = string.Empty;
    string FileName = string.Empty;
    string Clinician = string.Empty;
    string SenderID = string.Empty;
    string ReceiverID = string.Empty;
    string Type = string.Empty;
    string DenialCode = string.Empty;
    string PatientID = string.Empty;


    SubPatientID = txtPatientID.Text;

    if (!string.IsNullOrEmpty(SubPatientID))
    {
    DataTable dtPatientID = adm.SubFilesPaientID(SubPatientID);

    if (dtPatientID.Rows.Count > 0)
    {
    GridView1.DataSource = dtPatientID;
    GridView1.DataBind();
    }
    }

    foreach (ListItem item in drpFileName.Items)
    {
    if (item.Selected)
    {

    FileName += "'" + item.Text + "'" + ",";
    }
    }



    if (FileName.Length > 0)
    {
    FileName = FileName.Substring(0, FileName.Length - 1);
    }

    foreach (ListItem item in drpClinician.Items)
    {
    if (item.Selected)
    {
    Clinician += "'" + item.Text + "'" + ",";
    }
    }
    if (Clinician.Length > 0)
    {
    Clinician = Clinician.Substring(0, Clinician.Length - 1);
    }


    foreach (ListItem item in drpSenderID.Items)
    {
    if (item.Selected)
    {
    SenderID += "'" + item.Text + "'" + ",";
    }
    }

    if (SenderID.Length > 0)
    {
    SenderID = SenderID.Substring(0, SenderID.Length - 1);
    }


    foreach (ListItem item in drpReceiverID.Items)
    {
    if (item.Selected)
    {
    ReceiverID += "'" + item.Text + "'" + ",";
    }
    }

    if (ReceiverID.Length > 0)
    {
    ReceiverID = ReceiverID.Substring(0, ReceiverID.Length - 1);
    }



    foreach (ListItem item in drpType.Items)
    {
    if (item.Selected)
    {
    Type += "'" + item.Text + "'" + ",";
    }
    }
    if (Type.Length > 0)
    {
    Type = Type.Substring(0, Type.Length - 1);
    }

    if (!string.IsNullOrEmpty(Clinician))
    {
    DataTable dt = adm.GetClinician(Clinician);
    if (dt.Rows.Count > 0)
    {
    GridView1.DataSource = dt;
    GridView1.DataBind();
    }
    }

    if (!string.IsNullOrEmpty(FileName))
    {
    DataTable dtFile = adm.getFileReport(FileName);

    if (dtFile.Rows.Count > 0)
    {
    GridView1.DataSource = dtFile;
    GridView1.DataBind();
    }
    }

    if (!string.IsNullOrEmpty(SenderID))
    {
    DataTable dtSenderID = adm.GetSenderIDReport(SenderID);
    if (dtSenderID.Rows.Count > 0)
    {
    GridView1.DataSource = dtSenderID;
    GridView1.DataBind();
    }
    }

    if (!string.IsNullOrEmpty(ReceiverID))
    {
    DataTable dtReceivierID = adm.getReceiverIDReport(ReceiverID);
    if (dtReceivierID.Rows.Count > 0)
    {
    GridView1.DataSource = dtReceivierID;
    GridView1.DataBind();
    }
    }

    if (!string.IsNullOrEmpty(Type))
    {
    DataTable dtType = adm.GetTypeReport(Type);
    if (dtType.Rows.Count > 0)
    {
    GridView1.DataSource = dtType;
    GridView1.DataBind();
    }
    }

    if (FileName == "" && Type == "" && ReceiverID == "" && SenderID == "" && Clinician=="" && SubPatientID =="")
    {
    DataTable dtAll = adm.GetallData();
    if (dtAll.Rows.Count > 0)
    {
    GridView1.DataSource = dtAll;
    GridView1.DataBind();
    }

    }
    GetFiles();

    }
  • #767858
    You need to Enable the Viewstatemode property to make the DROPDOWNLIST visible after the event got fired.


    <asp:DropDownCheckBoxes ID="drpFileName" runat="server" AddJQueryReference="True" UseButtons="False" UseSelectAllNode="True" style="top: 0px; left: 0px; height: 19px;"> <Style SelectBoxWidth="400" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="130" ViewStateMode="Enabled" />

    Thanks,
    Mani

  • #767872
    Hi,

    Have you check in your browser debugger mode and check from where it is invisible, since we are end users for this requirement with out seeing your full stuff we can't judge. My suggestion is just check it by your end in browser and find the issue, if you still having doubts then refer below link this might be helpful to you.

    dotnetfox.com/articles/dropdowncheckboxes-or-drop-down-checkboxlist-control-in-Asp-Net-1100.aspx

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments