Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Cannot convert value of parameter?Cannot convert value of parameter?
Previous
 
Next
New Post
8/14/2007 11:15 AM
 

Maybe this might help you out a little. I hope I understand your post well enough, but it looks like you are having trouble getting database parameters out of your database and assigning them to controls on your form. If that is the case then:

1 - I assume somewhere you have an update button (or some other function)  where you take your form values and assign them to an active record (info) class then pass that class to your database via reflection for update.

2 - You probably also have a Page_Load function where you are taking those values from the database, assign them to an active record (info) class, then assign the active record (info) class properties to your form controls.

MyController myController = new MyController();

MyInfoClass myInfoClass = myController.GetInfoFromDatabase(ItemId);

chkMyCheckbox.Checked = myInfoClass.CheckBox;

txtMyText.Text = myInfoClass.TextBox;

 

I hope this helps you in some way. I typically avoid ObjectDataSource controls. They can sometimes be more trouble than they are worth. Plus the overhead associated with them is pretty heavy.

Good Luck.

 

 


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
8/14/2007 11:30 AM
 

HisKid,

Seems like this code is missing a bunch of declared tags. Even once I swapped info.
Didn't think storing a boolean value would be this hard.

It is accepting values within database as 1 for checked and 0 for unchecked.
Maybe I can play off that to my advantage.

-machina12

 
New Post
8/14/2007 2:14 PM
 

Ok, I think I am getting a handle on where we are at.

The code I posted was just a sample. I have no way of knowing what your classes actually look like.

There are three parts to DNN module development. They are not a true MVC design.  Most all .NET applications muddy up MVC. The UI can house business logic and the DAL contains a lot of business logic too. Not to mention what reflection does to your DAL. Given an ObjectDataSource control people tend to break even more design rules by implementing traditional DAL functionality right in the UI.

SO lets get back to basics...

You have a SQL Bit field that you need to convert to a boolean value.

In order to do this, you could do it when you assign your active record property to your checkbox control on your form in the Page_Load event in your UI using an IF statement; or you could do it in the active record contstructor. Personally, I would do it in the active record constructor. Your Info class is your active record. It has a constructor that assigns the values from the database to the properties you created. I noticed in your code that you didn't include the class constructor. There should be two constructors, a default constructor that simply initializes the class without any value assignment, and a hydrator constructor that populates the properties with values as it initializes the class. The hydrator constructor is where this bit value is assigned to your info classes boolean Checkbox property.

So, it may look something like

this.Checkbox = checkbox;

You may need to cast this bit value to boolean manually.

C# - _Checkbox = (bool)checkbox;

VB - uses the CType() method...

or

C# or VB - _Checkbox = Convert.ToBoolean(checkbox);

If you are unfamiliar with what an Active Record Pattern or what in the world MVC is, you may want to get a copy of Head First Design Patters. Its a great read.

Hope this helps.


Cheers!
John Valentine
http://www.webinnovationsystems.com
 
New Post
8/15/2007 11:51 AM
 

HisKid,

I greatly appreciate your time and attention to detail.
It's not that I don't want explore different methods, it is just that I am familiar with using ObjectDataSources for the transfer of information.
The code style I am using is VB & VB.NET, so some of the C# is different.

I did follow your last post, and am presently still trying your suggestions.
From what I have seen so far, I get all errors.

Noticed that this post is getting some decent viewing, so I am guessing there are others with same issue.
Does anybody using the ObjectDataSource VB/VB.NET know what we are overlooking in order to store a Boolean value?


-machina12

 
New Post
8/15/2007 1:17 PM
 

Post your entire code here or email it to me. Without seeing EXACTLY what it is you are doing we'll be talking and guessing for the rest of this century otherwise.

From the names of th files, I already see that you are using out-of-the-box compiled module template which really should've been modified... So I'd rather look at your code than guess any more.


Vitaly Kozadayev
Principal
Viva Portals, L.L.C.
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Cannot convert value of parameter?Cannot convert value of parameter?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out