.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

how to get the text of selected checkbox from asp.net checkboxlist control using jquery

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net

I have asp.net checkboxlist control that bounded to a data source so the number of items in the control are different from one to to another time.

I have this function:

     $('#<%=chkListGroups.ClientID %> input:checkbox:checked').siblings('label').text();

this function will return all texts for all selected items in the control as a one string.

 I'm looking for a way that when I check a check box from the ckeckboxlist control will return only last checked checkbox.

this code :

$('#<%=chkListGroups.ClientID %> input:checkbox:checked').last().siblings('label').text(); 

returns last checked item for example if I checked second will return
second item then when I checked fifth item will return fifth item but
if now when I check third item will return fifth item so it is always
returning last item checked in the list and I'm looking to

Please advice me how to do this using jquery.

View Complete Post

More Related Resource Links

Get selected row value based on checkbox selected in gridview using jquery

Hi ,    i am having gridview with two columns.one column contains checkboxes and another column contains Name.i have given UserId to DataKeyNames in gridview.Now i will check some checkboxes in gridview and click on button GetData. whenver i click on button GetData i need to get datakey values of all the gridview rows whatever checked in gridview using JQUERYPlease help me i am new to JQUery

jquery - assign a text to a textbox when checkbox is checked by client


hi guys.

I have a checkbox on my project and I have textboxes as well. I tried some jquery code as you can see below for this function;

I would like to get the ctl00$MainContent$firstnametxt.text value to ctl00$MainContent$firstnamedrivertxt.text value when the checkbox is clicked and I want the ctl00$MainContent$firstnamedrivertxt.text to be null if the checkbox is unchecked. how can I do that? the below one doesn't work for me.

<script type="text/javascript">
    //var myspan = $('#MyCheckBoxHere');

    $('#ctl00_MainContent_CheckBox1').click(function () {

        if ($(this).is(':checked')) {
        else {

css for space between checkbox & text in checkboxlist


Kindly guide how can we add space between text & check boxes of checkboxlist through css.


Pass Checkboxlist control multiple selected values to SQL table



I wanted to know if it is possible to pass multiple selected values from Checkboxlist to SQL table so each selections goes into separate row in the table.

I tried it using the following code (to pass ShowDate value) but it enters value only if I make one selection. It gives me an error message if I make two selections and try to pass it to SQL.


string showdate = string.Empty;

foreach (ListItem li in BirmShowDates.Items)
            if (li.Selected)
                showdate += li.Value;


            string sql = "INSERT INTO [BShow] ([Single], [UserId], [ShowDate], [Half]) VALUES (@Single, @UserId, @ShowDate, @Half) SELECT [Single], [UserId],  [ShowDate], [Half] FROM [BShow] WHERE [BShow].[ShowDate] = [BShow].[ShowDate]";

            SqlCommand cmd = new SqlCommand(sql, conn);

cmd.Parameters.AddWithValue("@ShowDate", showdate.ToString());


Thank you.

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

find a Control inside a GridView using jQuery


I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!

here is the code page: 

<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">

jquery autocomplete selected value



Iam using jquery autocomplete to search data and i have button to get the detail value of employee and

display in label , what i need is that , i don't want to put button to get detail , instead i need to select the from\

auto search and press enter key  and show the detail in the lablel example(empname,address, emailid).

Looking forward valuable suggestions

Customize failure text for login control


Hi all,

I would like to show the failure text in a client-side alert box for login control in c#. Please help me if there is an easy way to convert it from vb.net to c#.net. Thanks a lot!

Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError
'Display the failure message in a client-side alert box
ClientScript.RegisterStartupScript(Me.GetType(), "LoginError", _
String.Format("alert('{0}');", Login1.FailureText.Replace("'", "\'")), True)

 End Sub

 Converted, but it doesn't work.

protected void Login1_LoginError(object sender, System.EventArgs e)
    //Display the failure message in a client-side alert box
    ClientScript.RegisterStartupScript(this.GetType(), "LoginError", string.Format("alert('{0}');", Login1.FailureText.Replace("'", "\\'")), true);

Jquery date picker in ASP.NET Web user control does not work


Hello, I have the most frustrating problem and being new to JQuery does make it more difficult. I have an ASP.NET web user control with an ASP.NET box which I want to apply a JQuery date picker to, then of course I have server side code which takes the date and processes it etc. The date picker will not work. I can achieve a working JQuery date picker with an ASP.NET textbox if there is no user control involved, or within the user control I use a html text box instead, but once I add runat="server" to the text box, it does not work. Is there a way I can achieve this? (the web user control will be wrapped in an update panel too which at the moment will work with the html control/web user control without the server side functionality)

<%@ Register TagPrefix="TE" TagName="JobHistory" Src="test.ascx"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">


    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

    <link h

using jquery tooltip with asp:Chart control


I'm trying to use qtip (jquery plugin) instead of the standard tooltip control provided for the asp:Chart. I think the best way to do this is with an img map, though I don't know how to implement it. Does anyone know how to implement the img map for an asp:Chart?

Want to Create Table Dynamically With text Control in WinForm Csharp

Hello To All... from Many Days i m tryng to create a simple table using csharp in WinForm.Which will include textbox in each cell according the Passed No of Col & Row. but not getting the proper result. Actually i want to trace each cell data and want to save each cell data to data base : eg. in cell 11(1col & 1row) i m having Combobox which having some item list and when the user select the list item the data will save to the database. Regards, Praveen    What is the Key of Life ... Its Sharing Your Thought & Knowledge ...

jQuery Rating Control in Repeater - Not Duplicating per Record

Hi Everyone,There is a similar instance of this @ http://forums.asp.net/p/1380776/2919093.aspx#2919093 However I haven't had a response, maybe due to the age of the topic, but the problem is different in the sense I am not using AJAX Rating Control, I am using radio buttons contained in a Div named Ratings, which is picked up by jQuery to style to radio buttons accordingly. The output is that it will put the stars on the first record but anything after just shows origional unstyled radio buttons. Just thinking off the top of my head, but does anything need to be put in the ItemDataBound event? The jQuery for the stars etc were attained from the link below:http://orkans-tmp.22web.net/star_rating/index.html#demos=&main-menu=0&demo-tabs=3 Here is my code:.ASPX:<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Admin_Test" Title="Untitled Page" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="CPCHeader" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="AdminCPC" Runat="Server"> <asp:R

Need urgent help using JQuery DatePicker inside asp.net user control

Hello,I am able to use the DatePicker inside an aspx page with no problem at all but when I try to use that inside a usercontrol it gives me an error "Object expected"I have the links to my Jquery css and script files from the master page and have the following code inside a usercontrol:<script type="text/javascript"><!--    $(document).ready(function() {    var txt1 = document.getElementById('<%= txtDate.ClientID %>');    $(txt1).datepicker({ dateFormat: 'dd/mm/yy', duration: ''   });    });          // --></script><asp:TextBox ID="txtDate" runat="server"></asp:TextBox>

How do grab the value from label control into jQuery?

I have the following jQuery code working as it is (passing the value of 'test") but what I want to do is to pass the value of the label control (lblNames). I'm using the label control to collect the uploaded file names. Is there a way?jQuery:$(document).ready(function () {        $("#btnUpload").click(function () {            $("#Notes", top.document).val('test');        });    });ASPX code:<asp:Label ID="lblNames" runat="server" visible="true" ></asp:Label>

How to get selected text of a drop down list in MVC?

I aggressively googled around, but could not find the information I am looking for.  I know how to populate a dropdownlist using my view model and Html.DropDownListFor helper method.Suppose the drop down list contains U.S. stateId and stateName key value pairs.  Suppose my ViewModel looks likepublic class MyViewModel{      public IList<State> States {get; set;}      public int SelectedStateId {get; set; }}public class State{     public int StateId {get; set; }     public string StateName {get; set; }}Now, in my controller's action method:[HttpPost]public ViewResult Index(MyViewModel  myViewModel){     // This following line seems to work fine, myViewModel automatically      // picks up the selected item of the drop down list.  How does this work?      // Is this the so-called model binding?      int selectedStateId = myViewModel.SelectedStateId;      // But, then, how do I get the selected state name?     string stateName = ??????????????     ... ... }Do I have to change my implementation of my view model?  In any case, how to get the selected item text of the drop down list?  Any hint?  Thanks a lot.

How to control the text and other properties in ResourceDictionary object that i wrote ?

I wrote some ResourceDictionary. This ResourceDictionary is actuly a button that i use - I created this button by using Rectangle and TextBlock ==> that mean that the my xaml look like the code below. The problem is that i cant change the font size and the text of the TextBlock. I can change is just from the xaml of the template. And ... How can i define some variable that will control on the rectAngle redius in runtime ? Someone can help ?? ? Thanks. ...<ResourceDictionary> <Style x:Key="MyBtn" TargetType="{x:Type Button}"> <Rectangle ... <TextBlock.... </ResourceDictionary> ...
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend