WebSneak Webmaster Forums

home FAQ Members List search Quick Links

Go Back WebSneak Webmaster Forums » WebSneak MarketPlace » Services » Programming » asp checkboxes  

Programming Place to look for programmers to complete your projects.

Reply
 

 

LinkBack Thread Tools Display Modes  
Old 01-25-2008, 07:22 AM   #1 (permalink)
Junior Member
 
Join Date: Jan 2008
Posts: 3
oliver5 is on a distinguished road
Default asp checkboxes

I have a solution to this problem already, but it's not pretty and i'd like to see if there is a better one. Here is the problem:

I have a database, and in that database there is a table called Servers.
This is a Microsoft SQL Server Express Database(Not enterprise level).
The database contains the following fields (this is not a complete list of all fields):
serverID int identity,
networkID int not null,
customerID int not null,
serverName varchar(25) not null,

And these are the fields in question

PDC tinyint,
BDC tinyint,
EXCH tinyint,
SQL tinyint,
WWW tinyint,
FTP tinyint,
WTS tinyint,
DHCP tinyint,
DNS tinyint,
WINS tinyint,
POP tinyint,
SMTP tinyint,
PPTP tinyint,
isBackup tinyint.

Now I have a formView control on my asp.net page, the control has a readOnly and Edit mode, no insert. Those fields are representative of boolean values, and when adding a server to the database I just use a for loop to populate the various different values:

Dim x As Integer = New Integer
Dim y As Integer = 17
Dim myVar As Integer = New Integer
For x = 0 To 13 Step 1
If CType(Me.addServerFormView.FindControl("infoCheckB oxList"), CheckBoxList).Items(x).Selected() = True Then
myVar = 1
Else
myVar = 0
End If
Me.SqlDataSource1.InsertParameters(y).DefaultValue () = myVar
y = y + 1
Next

This is where SqlDataSource1's insert parameters for the afore mentioned database fields starts at field 17 and there are 13 values.

That works fine, now the question is, when outputting these values, I have to systematically(with a for loop) check to see if the value is 0 or 1, and if it is, display the proper text corresponding to the field name. if 1 then the server has that capability and display the text, and if 0 then don't display the text but still pass the value 0 for the update from read Only mode.

Sorry, this is a lot to articulate at once, I may need to clarify some things.
Now the problem is that all of this required a lot of code, and looking through the page. For those not very familiar with vb, the FindControl() Method is similar to javascript's getElementById(), only you have to adhere to stricter XML standards as far as child vs root elements go. Then to output the values to the read only, I have invisible <asp>'s that get the value, be it 0 or 1. I then have code that says when these are done loading, get the values, and change the text in these textboxes to the field name, be it PDC(Primary Data Server), or BDC(Backup Data Server) just to name a few. That is a pretty messy way of getting things done, and it's not 100% reliable i've found out. What can I do?
__________________
custom essay Rasenmäher
oliver5 is offline   Reply With Quote
Old 10-05-2008, 09:16 PM   #2 (permalink)
Junior Member
 
Join Date: Oct 2008
Posts: 3
a_kanna230 is on a distinguished road
Default asp

ASP( Active Server Page) is The Server side scripting language.it will used for web pages
in the modern world.


__________________________________________________ ___________

Sharp LCD TVs Videogiochi per la wii
a_kanna230 is offline   Reply With Quote
Reply

« visual basic | - »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump