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

Post New Web Links

Checkbox does not remained checked

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net


I'm having a problem with my check box on my ASP form.  When clicking on it it will execute the code attached to it (in C#) without any problems.  The issue arises when the page posts back.  When it posts back, the check box does not save its state and becomes unchecked.

Can anyone shed some light on this for me?

Thanks in advance

View Complete Post

More Related Resource Links

How to set the checkbox state "checked or not checked" from a database


hey In the code I have here, I need to set the checkbox state from a database but I dont know the properties:

while (l_objRead.Read())
                         //txtUserName.Text = l_objRead["UserName"].ToString().Trim();
                         txtWerknemerNaam.Text = l_objRead["Naam"].ToString().Trim();
problem here => cbAktief.CheckState = l_objRead["Aktief"];

don't know how to set the state, help pleaz :)

Checkbox Checked


I am currently trying to write some code that allows an admin to add users to a system by selecting a checkbox and then clicking a button at the top of the screen that will allow for a mass user add.  I am new to ASP and am trying to figure out how to make the system recognize each checkbox that is checked only to add to the database.  Any ideas on where to start on this?  Thanks

Html.CheckBoxFor - how can I make checkbox default checked ?

I have:Html.CheckBoxFor(model => model.available) how can I have checkbox default checked ?

Checkbox checked changed event inside gridview

Hi All, In my gridview there are 8 checkboxex in each row : 'Sunday' to 'Saturday' and one for 'All'. If 'All' is checked in a particular row, all other checkboxes in that row should be checked instantly, and viserversa. Can i do this in checkbox checked_changed event, if so how do i access the current row of the gridview in the checked changed event? Thanks in advance

Enable/Disable controls in a td when checkbox is checked

hi,I have a table with 10 rows.Each row having 3 asp controls (checkbox,textbox and dropdownlist).on pageload all controls except checkboxes should be disabled and If we check any checkbox the controls(textbox and dropdownlist) in that row are should be enable.pls reply me.Thanks in Advance.

Validate time (MaskedEdit) if checkbox is checked

Hi,I'm using AjaxToolkit and it works just fine. In one form i'm using the Time field (MaskedEdit). I need to validate Time field only if a tickbox is ticked. Is it possible?Thanks in advance,Vladimir

Using CheckBox in DataList to set checked property

  I have a field called receive e-mail, field char (1) = "Y" (Yes) out "N" (No). I am using the DataList Control CheckBox inside when you enter Edit mode code EditTemplate am placing the following code:<Asp: DataList ID = "DataList1" runat = "server ".... " ye="" closure_uid_uriylf="527"><EditItemTemplate><Asp: CheckBox ... '/> " ye="Checked='' />" closure_uid_uriylf="529">Checked ='<%# Eval ("CHR_OPTIN_SMS ")==" S"? True: false%> '/> " ye="" closure_uid_uriylf="530" mce_style="BACKGROUND-COLOR: #fff"></ EditItemTemplate>.... " ye="" closure_uid_uriylf="532" mce_style="BACKGROUND-COLOR: #fff"></ Asp: DataList>When I run the program with any records he did not show marked and should be checked when the database is "S" in the field CHR_OPTIN_SMS.Could someone help me? if the above code is correct, if not, what should I do to solve this problem.

Getting checked value of a checkbox created at runtime c#

Getting checked value of a checkbox created at runtime c# I use visual studio 2008, and vc# in my program i create a series of controls, inlcuding checkboxs inside an arraylist, with i=0 and increment with each control: this.arylTxtGEItems.Add(new System.Windows.Forms.CheckBox()); ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).Location = new System.Drawing.Point( groupBoxParametros.Location.X + 20 + (c * (w + 20)), groupBoxParametros.Location.Y + 45 + (r * (h + 16))); ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).Name = "CheckBox_" + i.ToString(); ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).Size = new System.Drawing.Size(128, 21); ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).TabIndex = j + 2; ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).Text = "&All"; ((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i]).Checked = true; this.Controls.Add(((System.Windows.Forms.CheckBox)this.arylTxtGEItems[i++])); It works good, i can see my controls and use them :) The problem is that i dont know how to access a control that i created this way, for example the name of the first checkbox, is "CheckBox_0" how do i get the value of "CheckBox_0".Checked? Thank you for your help saludos rubenc  

How to use jQuery to set checkbox is checked


How do I use the jQuery set
If checkbox's value in the string (cbx1, cbx2, cbx5, cbx7),
set the checkbox is checked.
Thank you

How do I use the jQuery set

If checkbox's value in the string (cbx1, cbx2, cbx5, cbx7),

set the checkbox is checked.

Thank you

Checkbox not checked with spacebar



    In my application i am using DataGrid and as datagrid items i am using checkbox. For it i am using template as,

 <my:DataGrid Margin="10,10,10,10"
                     AutoGenerateColumns="False" RowHeaderWidth="0" 
                     FontSize="12" IsTabStop="False"                      
                     SelectionMode="Single" CanUserAddRows="False"            
                     ItemsSource="{Binding}" GridLinesVisibility="None"                   
                     Width="390" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard"
                     HeadersVisibility="None" >

              <CheckBox Margin="2,0,0,0" Content="{Binding}" Width="380">

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 {

How to render a checked CheckBox to a RenderTargetBitmap ?


My checkbox is rendered without a check mark.  If I use only one checkbox (instance object) to render then I can get the check mark to show, but I cannot use this solution.  I need be able to render it using the local checkbox.  This checkbox has the Aero theme applied to it by default and this is also a must have for me.  Other themes built-in themes like Royal, and Luna render with a check mark.


<Canvas Name="canvas">
  <Button Click="Button_Click" Canvas.Left="440" Canvas.Top="

Set Checkbox.checked on modalpopup

I'm having trouble setting the checkbox.checked on a modalpopup. setting textbox.text is no problem.
Hop somebody can help me.
 <asp:Panel ID="pnlAddChild" runat="server" CssClass="Back_ModalPopup" style="display:none" Width="250" Height="350">
            <h1 class="Back_bodycontent">Add Child</h1>       
            <asp:Label ID="lblAddLabelNL" Text="Label:" runat="server" Width="50px"/>
            <asp:Textbox ID="tbAddLabelNL" runat="server" />            
            <br />
            <asp:Label ID="lblAddLinkNL" Text="Link:" runat="server" Width="50px"/>
            <asp:Textbox ID="tbAddLinkNL" runat="server" Text="http://" />
          <br />
            <asp:Label ID="lblActive" Text="Actief:" runat="server" Width="50px"/>
            <asp:PlaceHolder ID="phCHNL" runat="server" />            

Custom checkbox control 'checked' property is not working .


Hello ,


Iam developing a custom checkbox control deriving from the 'compositecontrol' which i need to use it for a composite control purpose.



public class TngCheckBox : CompositeControl


i have written the required properties which are working fine except the "checked" property. he

Check if a checkbox is checked


When i check a checkbox i want to store some information to the database...

I write my checkbox in my Default.cs like this : "<td><INPUT TYPE='CHECKBOX'  NAME='"+ number +"' VALUE='hoi'></td>";

the number will change for every checkbox in the table.

how can i controle that i have set my checkbox?

How to check if at least one checkbox is checked in a DataGrid



I was trying to find out if there are any check boxes checked in the datagrid, if non of them is checked it should show me an alert to select atleast one.

My problem starts when there is paging in datagrid...

not able to check the entire datagrid at a time in itemDataBound event for the checked check boxes !!!!!


Calculate The Value of checked grid checkbox using javascript



         i am using a grid view with a check box, after binding the data on data grid it genrated 5 row with checked, check box, now i want when user uncheck some of check box then the value related to previous collumn of row are substracted from total value, and as user check some of check box again then the total will be filled again.

for this process i write the code as:

<script type="text/javascript">
    function CheckChange(id) {
        var grid = document.getElementById("<%=grdViewClearingSchedule.ClientID  %>");
        var cell;
        var amt;
        var TotalAmt = parseFloat("0");
        if (grid.rows.length > 0) {
            for (i = 1; i < grid.rows.length; i++) {
                cell = grid.rows[i].cells[5];

                if (cell.childNodes[0].type == &quo

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