473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

checkbox?

hi i need to update checkbox values to database which is in formview control depending upon wat the user selects?
i ve written the code lik dis but here its updating depending upon the first checkbox
for ex if the first checkbox is true its taking the remaining checkboxes values also as true no matter if their value is false and the same happens for viceversa?
can any1 help me regarding dis?
the code i ve written is below
Expand|Select|Wrap|Line Numbers
  1.   CheckBox EmployeeRequestUploadedMailIntranet = ((CheckBox)frmviewpreference.FindControl("chkbxClientRegisMail"));
  2.                    bool  EmployeeRequestUploadMailIntranet=EmployeeRequestUploadedMailIntranet.Checked;
  3.                     CheckBox EmployeeRequestUploadedInternet = ((CheckBox)frmviewpreference.FindControl("chkbxClientRegisMail"));
  4.                    bool  EmployeeRequestUploadInternet=EmployeeRequestUploadedInternet.Checked;
  5.                    //Updating the preferences of the client using SqlHelper.
  6.                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "Update tClient set EmployeeRequestUploadedMailIntranet='" + EmployeeRequestUploadMailIntranet + "',EmployeeRequestUploadedInternet='" + EmployeeRequestUploadInternet + "' where ClientID=" + Session["clientId"]);
  7.                    lblmsg.Text = "Preferences Updated";
Mar 14 '08 #1
1 1134
Frinavale
9,735 Expert Mod 8TB
hi i need to update checkbox values to database which is in formview control depending upon wat the user selects?
i ve written the code lik dis but here its updating depending upon the first checkbox
for ex if the first checkbox is true its taking the remaining checkboxes values also as true no matter if their value is false and the same happens for viceversa?
can any1 help me regarding dis?
the code i ve written is below
Expand|Select|Wrap|Line Numbers
  1.   CheckBox EmployeeRequestUploadedMailIntranet = ((CheckBox)frmviewpreference.FindControl("chkbxClientRegisMail"));
  2.                    bool  EmployeeRequestUploadMailIntranet=EmployeeRequestUploadedMailIntranet.Checked;
  3.                     CheckBox EmployeeRequestUploadedInternet = ((CheckBox)frmviewpreference.FindControl("chkbxClientRegisMail"));
  4.                    bool  EmployeeRequestUploadInternet=EmployeeRequestUploadedInternet.Checked;
  5.                    //Updating the preferences of the client using SqlHelper.
  6.                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "Update tClient set EmployeeRequestUploadedMailIntranet='" + EmployeeRequestUploadMailIntranet + "',EmployeeRequestUploadedInternet='" + EmployeeRequestUploadInternet + "' where ClientID=" + Session["clientId"]);
  7.                    lblmsg.Text = "Preferences Updated";
You are setting both EmployeeRequestUploadedMailIntranet and EmployeeRequestUploadedInternet to the same value...being:
Expand|Select|Wrap|Line Numbers
  1. ((CheckBox)frmviewpreference.FindControl("chkbxClientRegisMail"));
This is why both of your values are the same.

Cheers!
-Frinny
Mar 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Fabri | last post by:
How can I, on button click, to select ONLY the following 4 checkbox? I would like to do this without a for loop through form.lenght because this is only an example and I have to apply this script...
4
by: feanor | last post by:
I need to select children checkboxes when selecting the parent one. This is my function: function SelectChildrens(checkbox_name){ form = document.forms; Sname = checkbox_name.split("-"); for...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
2
by: bebop | last post by:
I'm using three checkbox web controls in C# .NET and one button, and one labe Is there a way to "group" these individual checkbox web controls If so, do I use a for loop, hashtable, array,...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
2
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: Wolfgang Uhr | last post by:
Hello I've the following code Panel pnlData = new System.Windows.Forms.Panel(); CheckBox checkBox = new System.Windows.Forms.CheckBox(); checkBox.AutoSize = true; checkBox.Dock =...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.