Showing posts with label Checkboxlist. Show all posts
Showing posts with label Checkboxlist. Show all posts

Wednesday, November 2, 2016

How to create Dropdownlist with checkboxes in asp.net

In this article I am going to explain how to create Dropdownlist with checkboxes in asp.net.

How to create Dropdownlist with checkboxes in asp.net


Description:
Recently while working on asp.net project, I have got requirement of checkboxes inside dropdownlist. I have did R&D on it and found a DLL of DROPDOWNCHCKBOXES. It’s a custom server control.

Saturday, March 5, 2016

Asp.net: Get comma separated values from database and bind to checkboxlist

In this article I am going to explain how to get comma separated values (data) from database and bind to checkboxlist in ASP.Net using C# and VB.net

Implementation:
I have created a table Tb_Technology:
Id
int
Technology
varchar(50)

Insert the dummy data into table:

Insert into Tb_Technology(Technology) values('Asp.net,Php,Java')

Add a webform to project. Drag and drop the require control (checkboxlist) from toolbox to webform.

Thursday, March 3, 2016

Insert multiple selected values of checkboxlist to database as comma separated in ASP.Net

Monday, September 2, 2013

Validate Checkboxlist using Jquery in asp.net

Introduction: In this article I have explain how we can validate the CheckBoxlist using Jquery in asp.net.
Validate Checkboxlist

Description:
Add a webform to project. Drag and drop the CheckBoxlist and button controls from Toolbox. Desgin the .aspx as shown below:
<table align="center"><tr><td>Known Language:</td><td>
        <asp:CheckBoxList ID="chklanguage" runat="server"
            RepeatDirection="Horizontal">
        <asp:ListItem Text="English" Value="0"></asp:ListItem>
        <asp:ListItem Text="Hindi" Value="1"></asp:ListItem>
        <asp:ListItem>Punjabi</asp:ListItem>
        <asp:ListItem>German</asp:ListItem>
    </asp:CheckBoxList></td></tr>
                        <tr>&nbsp;</tr>
                    <tr><td>&nbsp;</td><td>
                        <asp:Button ID="btnsubmit" runat="server" Text="Submit"/></td></tr>
    </table>

Keep the below given Jquery in between Head Tag (Select minimum Two Language):

   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script type="text/javascript" language="javascript">
            $(document).ready(function () {
                $('#btnsubmit').click(function () {
                    //validate only for one value
                    //if ($('#chklanguage input:checked').length > 0)
                    if ($('#chklanguage input:checked').length > 1) {
                        return true;
                    }
                    else {
                        alert('Select atleast two Language')
                        return false;
                    }
                })
            });
</script>

Run the project and check the result.

Is it helpful?


If yes post your comment to admire my work. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

Tuesday, May 14, 2013

How to insert multiple Checkboxlist value into database in asp.net


Introduction: In this post I will explain how we can insert the multiple selected value of Checkbox list into database.
Description:
I have created table name QUALIFICATION. ID is primary key.
ID
int
CANDIDATE_QUALIFICATION
varchar(50)

Now go to Visual Studio and take new website. After that add a webform to application. Drag and drop Checkboxlist control from Toolbox.
<asp:CheckBoxList ID="chkeducation" runat="server">
        <asp:ListItem>M.SC.</asp:ListItem>
        <asp:ListItem>MBA</asp:ListItem>
        <asp:ListItem>B.TECH</asp:ListItem>
        <asp:ListItem>MCA</asp:ListItem>
        <asp:ListItem>B.SC.</asp:ListItem>
        <asp:ListItem>POST GRADUATION</asp:ListItem>
        </asp:CheckBoxList>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Insert" />

Now go to .aspx.cs page. Add namespace.
using System.Data;
using System.Data.SqlClient;
using System.Configuration;