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
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:
x As Integer
= New Integer
y As Integer
myVar As Integer
= New Integer
x = 0 To
(Me.addServerFormView.FindControl("infoCheckBoxLis t"), CheckBoxList).Items(x).Selected() = True Then
myVar = 1
myVar = 0
.SqlDataSource1.InsertParameters(y).DefaultValue() = myVar
y = y + 1
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