checkboxlist how to check if is not checked..

hello everybody... i spend an awful long time trying to figure this one out.. it might be simple but i can't figure out...i can loop and update my database with the items inserted.. but now i want to delete the records if they unchecked the checkbox.. so i need to perform the second part of the code to delete the values from the database.. but i can't figure out how to loop through the items not selected... here is the code...

SqlConnection con = new SqlConnection(connectionString);

SqlCommand cmd = new SqlCommand("IMS_Insert_OrderCharges", con);cmd.CommandType = CommandType.StoredProcedure;

con.Open();

 

try

{

CheckBoxList chkbx = (CheckBoxList)form1.FindControl("CheckBoxList1");

 

for (int i = 0; i < CheckBoxList1.Items.Count; i++)

{

if (chkbx.Items[i].Selected)

{

cmd.Parameters.AddWithValue(
"@ID", Request.QueryString["id"]);cmd.Parameters.AddWithValue("@ChargeType", CheckBoxList1.Items[i].Value);

cmd.ExecuteNonQuery();

cmd.Parameters.Clear();

}

else //if (!chkbx.Items[i].Selected)

{

cmd.Parameters.AddWithValue(
"@ID", Request.QueryString["id"]);

cmd.Parameters.AddWithValue("@ChargeType", CheckBoxList1.Items[i].Value);

cmd.Parameters.AddWithValue("@Action", "1");

cmd.ExecuteNonQuery();

cmd.Parameters.Clear();

 

}

 

}

 

 

thanks for your help...

0
mitoy75
2/5/2009 7:23:57 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

1 Replies
730 Views

Similar Articles

[PageSpeed] 47

mitoy75:
so i need to perform the second part of the code to delete the values from the database.. but i can't figure out how to loop through the items not selected...
 

  

        foreach (ListItem item in CheckBoxList1.Items)
        {
            if (item.Selected == false)
            { 
                //do delete operation here
            }
        }
 
Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
2/5/2009 9:02:40 PM
Reply:

Similar Artilces:

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Better to ask this in the source control group. Lots of posts on PBNative -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69678e.7b3a.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Native. ...

Check in
Hi all. I am migrating from PB 7.0 to PB 10.5, After migrating my first application i am trying to work on my first window but i'am not able to find out the way to CHECK it OUT. Wher do i can find "check out/check in" functions ?? TIA Mario Parietti What source control are you using? Have you configured it? Right click on your Workspace and check the source control tab to see if you've got it set up. "Mario Parietti" <mparietti@intercad.ch> wrote in message news:451283e0$1@forums-1-dub... > Hi all. > I am migrating from PB...

Check In/Check out
I am using PowerBuilder 9. The undo check out is right next to the check in. This is a big problem! I so easy to select Undo check out and lose all of your changes. I lost 8 hours of work yesterday because of it. I know I should be more careful. However, there should be a "Are you sure" some where also. PLEASE FIX!!!!!!!!!!!!! -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ This isn't the tech support line, it's an end-user forum. If you want to report a bug, use CaseXpress and either open a case or report a bug ...

Check out/check in
Hello How can i use the process check out/check in in PowerBuilder 8.0.3 ? We work in network. The Source Control is PB Native. I don't understand what is the parameters of Source Control ? Thank you Have you looked the PB8 User's guide? Chapter 3 talks about source control. -- Evita Chapa Senior Systems Analyst II Command Technologies Inc. <Herv� Bareth> wrote in message news:3f69ba0a.592b.846930886@sybase.com... > Hello > > How can i use the process check out/check in in PowerBuilder > 8.0.3 ? We work in network. The Source Control is PB Na...

Check-in/Check-out
I'm having some difficulty with powerbuilder's check-in/check-out operation. When I check an object back in, the .pbl the object is being moved from is destroyed. Has anyone else experienced this and is there a fix? Cheers, Tom Thomas F. (Tom) Massey wrote: > > I'm having some difficulty with powerbuilder's check-in/check-out > operation. When I check an object back in, the .pbl the object is > being moved from is destroyed. > > Has anyone else experienced this and is there a fix? > > Cheers, > > Tom The prob...

Checked=Checked
 I am dynamically writing out checkboxes on a page.  I have 2 link buttons on the page that sets a boolean variable to True or False. This boolen is set in Page_PreInit and is used to Select or Deselect all the Checkboxes as they are written out. A Select ALL, Deselect ALL type of thing. At least that is the plan. As the page is being written out I do this for each checkbox and then add it to a table cell control that it added to a table row and on. tc is the table cell.  Dim chkItem As CheckBox = New CheckBox chkItem.ID = "chkRecommend" + drMember("ID")...

Check In Check Out
I have some source code that I need to modify and it was sent to me in a Registered status. Therfore, when I open any object it says " 'object name' is registered but not checked out and therefore can not be overwritten. Open anyway?" Then when I try to check it out, I get "PBNative checkout not allowed for registered objects." How can I get around this? When I look under the "Source" menu, all the items concerning registered are grayed out. TIA Option1:Copy the object(Only) to someother pbl and try . Option2:If You have any SCC Expo...

if checkbox is checked , then all the checkboxlist should be checked
i have a checkbox list and a checkbox , i want f the checkbox is checked then all the checkboxes in the checkboxlist should be checked as well.   Please suggest , if there is any way out   Thanksneelu gupta Do u want this to be done on the client side or server side? And are these check boxes server controls or html controls??Shravan Addaypally MCP maybe this thread can help.> penny for a thought...

VS.Net Check In/Check Out Function
Hi All, I work on a team of developers who are just trying to get started with ASP.Net.  I've been doing development for 2+ years so it's not new to me but my colleagues have asked a question about the VS.Net environment that I can't answer.  We're trying to find out if there is some sort of Check In/Check Out function with Visual Studio.Net.  I've never worked in a team environment before so I couldn't answer this.  The reason we're wondering is because we're planning on setting up our online forms in a DotNetNuke style environment (one page, loads user contro...

How to check if a CheckBoxList has an item checked in javascript
Hi,I have a usercontrol with a checkboxlist and a button. The button should be disabled if no item in the checkboxlist is checked. This is the code: 1 <script type="text/javascript">2 function Enable_Send()3 {4 var sendButton = document.getElementById("defaultframework__ctl14__ctl5_SendButton");5 var cblMembers = document.getElementById("defaultframework__ctl14__ctl5_cblMembers");6 7 if(cblMembers.selectedIndex == -1)8 {9 alert("if");10 sendButton.disabled = true;11 }12 else13 {14 alert(&qu...

How to setting checked or not checked if checkboxlist is in DataGrid?
if it's a single Checkbox in DataGrid , I use these code to bind with DataTable ( =1 checked , =0 not checked)    <asp:TemplateColumn HeaderText="Member"> <ItemTemplate><asp:CheckBox id=SecSA runat="server" Enabled="False" Checked='<%# DataBinder.Eval(Container, "DataItem.SecAmbassador") %>'></asp:CheckBox></ItemTemplate><EditItemTemplate><asp:CheckBox id=ckSecSA runat="server" Checked='<%# DataBinder.Eval(Container, "DataItem.SecAmbassador") %>'&...

how to check if a check box created in runtime checked or not?
I have a webform that have mutiple collectios of check boxes created on run time ( database driven) what is the best way to loop between them and get which ones has been checked by a user and save the results back to the database below a portion of my code. i am adding the checkbox to cell table which added to a row, then to a table, finlally the table added to a place holderwhile (drProfileList.Read()) {HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell tc = new HtmlTableCell();CheckBox chkbox = new CheckBox(); chkbox.ID = drProfileList["RoleID"].ToString();chkbox.T...

checking checkbox is checked or not using checkbox.checked
Hi,my checkbox is<asp:CheckBox ID="Chkcity" runat="server" Text="My own city"  OnCheckedChanged="EventHandler"/>code behind: Private Sub Chkcity_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chkcity.CheckedChangedif (Chkcity ...............)end if End SubERROR    'EventHandler' is not a member of 'ASP.bpoaddjob_aspx'.    Please Mark the post as "ANSWER" if it helps you I think it should be like this:<asp:CheckBox ID="Chkcity"...

Check All Check Box While Check Header CheckBox
 hello...I have two grid on same page...both grid contains header checkbox and item checkbox i want that if use check header checkbox then all item check box checked,i have javascript for this functinality but problem is that when i click on header check box of first grid then checkbox of second grid also checked that i dnt want i want to perform this operation on one grid at one time.i have attache my script also...plz help me....thanks<script type="text/javascript">        function SelectAll(ID)      &nbs...

Web resources about - checkboxlist how to check if is not checked.. - asp.net.getting-started

APNS Pusher, debug your push notification app - Coders Grid
Coders Grid your best development resources collections site Menu Skip to content Resource web development design stuffs guideline coding mobile ...

.NET sample code - developer Fusion
Discover the very latest .NET sample code Out of the box, the ASP.NET list controls (CheckBoxList, RadioButtonList, DropDownList) only support ...

ConditionalRequiredTextValidator Control
The ConditionalRequiredTextValidator control allows you to specify a CheckBox, RadioButton, CheckBoxList, RadioButtonList, DropDownList, or ListBox ...

Sports-Gazer - About Us
Sports-Gazer is an application for ranking and rating sports teams. It also can project scores for upcoming games. Certain parts of this application ...

Layar 3.0 mobile augmented reality browser launched
Layar, the world’s first augmented reality (AR) browser…

ASP.NET 4 and Visual Studio 2010 Web Development Overview : The Official Microsoft ASP.NET Site
This document provides an overview of many of the new features for ASP.NET that are included in the.NET Framework 4 and in Visual Studio 2010. ...

Gaiaware - Gaia Ajax
Home Samples Download Free Trial Buy from $195 Login Download Free Trial ASP.NET Done Right 6 reasons to use Gaia Ajax? 40 UI controls 10 aspects/behaviors ...

compass - Coders Grid
Coders Grid your best development resources collections site Menu Skip to content Resource web development design stuffs guideline coding mobile ...

APNS Pusher, debug your push notification app
Coders Grid your best development resources collections site Menu Skip to content Resource web development design stuffs guideline coding mobile ...

Buttons.css, a css library makes buttons beautiful - Coders Grid
Coders Grid your best development resources collections site Menu Skip to content Resource web development design stuffs guideline coding mobile ...

Resources last updated: 12/11/2015 7:21:42 PM