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

    How to achieve multi select dropdown checkbox list control in ASP.Net

    Hi good evening everyone, I am making a web based application 'Workshop Management' using C#, ASP.Net and SQL Server and have got stuck at this issue

    I have a jobcard page which contains various fields like jobcard no,
    datein, dateout etc which can be accomplished with a simple textbox control but there are three more fields namely faultsFound, repairCarriedOut, sparesRequired where I want them to be displayed as dropdown checkbox list so that i can select multiple values at once and then store those values in database.
    And this spares required will be listed against each jobcard number and displayed to the storekeeper once he login.
    The storekeeper will then provide the available spares and place a demand for the spares which are not available in store.

    The number of items in each of above three fields (faultsFound, repairCarriedOut, sparesRequired) varies between 20 to 30 items ex: sparesRequired contains items like : head light, rare view mirror, coolant etc
    There is no dropdown checkbox list control available for webforms. Pls guide me on this how can I achieve this.

    Thanks in advance.

    Technical Details :
    IDE : Visual Studio 2012.
    Programming Language : C#, ASP.Net
    Backend DB : SQL Server 2016
  • #769372
    ListBox:
    <asp:ListBox runat="server" ID="MultilblSelect" SelectionMode="multiple">
    <asp:ListItem Text="1" Value="1" />
    <asp:ListItem Text="2" Value="2" />
    <asp:ListItem Text="3" Value="3" />
    </asp:ListBox>

    foreach(ListItem listItem in MultilblSelect.Items)
    {
    if (listItem.Selected == True)
    {
    var val = listItem.Value;
    var txt = listItem.Text;
    }
    }

    hope this will help.


  • Sign In to post your comments