473,395 Members | 1,581 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,395 software developers and data experts.

if a checkboxlist is not selected shows save as number 0 in DB

3
I'm working in a web aplication in c#, vs 2008, framework 3.5, I need to assign a value to a var, in this case "problemas",
when I tried to save the value that I have in the checkboxlist, it does, but if don't selected, can't show 0, besides if I change the value "problemas = 9" to problemas = 111111" doesn't works, I've tried a lot of options but nothing works to me, please help, thanks in advance.

Expand|Select|Wrap|Line Numbers
  1. protected void ckblProblemas_SelectedIndexChanged(object sender, EventArgs e)
  2. {
  3. int problemas = 0;
  4. {
  5. if (ckblProblemas.SelectedValue.Equals("9"))
  6.                 {
  7.                     problemas = 9;
  8.                 }
  9.  
  10.                 else
  11.                 {
  12.                     problemas.Equals("0");
  13.                 }
Sep 26 '12 #1
2 1571
kadghar
1,295 Expert 1GB
I'm not quite sure i understood, if the problem is to make problemas = "111111", change its type, since an integer cannot be larger than 32,000 (aprox). Use a long.

If your problem is with the selected value. Select a default value in the 'load' sub.

HTH
Sep 27 '12 #2
suely
3
I can handle problemas=111, it was just an example because I realise that doesn´t save the value from problemas=111.. but in my database I save the value, my problem is if the user don´t select anything in the checkboxlist, I need to save that as a 0 in my db, but now I can´t, anyway, I'll try what you said, thanks for your reply. :)
Sep 27 '12 #3

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

Similar topics

3
by: luisg | last post by:
I am having some difficulty getting a checkboxlist control to determine which checkboxes are checked. Here is a code sample from the event that should read it: private void...
0
by: jhoge123 | last post by:
Anybody know how to bind a CheckBoxList in such a way that some of the boxes are checked by default an some not? In other words, bind it to a boolean field that indicates whether the box is checked?
1
by: Patrick Olurotimi Ige | last post by:
I 'm databinding a CheckBoxList control Can somebody forward me a sample how to get if a checkBox is selected i want to return TRUE and if not FALSE? Thanks *** Sent via Developersdex...
3
by: Alex D. | last post by:
does any body knows how to get the checkbox clicked in a checkboxlist using the SelectedIndexChanged event? The "EventArgs" dont help too much.. thanks, Alex.
1
by: Larry R | last post by:
Can anyone tell me how to bind a CheckBoxList to a Business Object (class) using the ObjectDataSource? Thanks in advance.. Larry
1
by: cybercus2 | last post by:
Hi.. I want to save a number like 001 and so on in access database. I've tried something like this but it didn't work strSQL = "Insert into (UserID) VALUES" & "(" & Format(strNewID, "0##") & ")"...
3
by: Margie | last post by:
Hello all, after getting no where with my Access 2007 database problem for an entire week I figured I could use some outside help. Wanting to skill myself in Access, I decided to make a movie...
2
by: realNewbie | last post by:
I am trying to duplicate the Guess My Number Game from Python Programming for the Absolute Beginner by Michael Dawson but for some reason I still cannot figure out my output is not completely...
0
by: =?Utf-8?B?eWg=?= | last post by:
is there a way to get the selected item sequence of the checkboxlist? for example, user tick item4,item1,item2, i need to get 4-1-2, not 1-2-4. thank you.
3
by: sierra7 | last post by:
Hi, I have a report that displays the correct data in Preview but displays #Name? when printed. (Access 2003) The field is unbound but the control source is read from a form =!. & " (Week " &...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.