Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Maximum ASP
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Indoo
 


  Sponsors  

Meet Our Sponsors

ExactTarget email software solutions
Merak Mail Server
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! (Pro...  Converting comma separated values from string to integer with Linq
Previous Previous
 
Next Next
New Post 5/7/2008 12:49 PM
Unresolved
User is offline toadkicker
28 posts
10th Ranked


Converting comma separated values from string to integer with Linq 

Hello DNN community,

I'll try to keep things generic so others can apply this to their situtations.

I have a CheckBoxList control that is databound to a LinqDataSource. TableA is like this:

ID | Name

1 | Paul

2 | Bill

and so on....

Table B is

ModuleID | LoadTypes

1032 | 1,2

The index values from the checkboxlist are equal to the ID's from the table. I then have to store these values in TableB as a CSV list. So I do the following:

            Dim strListItemIDs As String = ""
            For Each li In chkListTypes.Items
                If li.Selected Then
                    strListItemIDs += li.Value & ","
                End If
            Next

(Yes I trim the comma off later on)

So where I am stuck is on the return trip to this page the check boxes need to be selected from this CSV list of values. I get that I need to do

Dim types = From loadedTypes In db.TableB Where loadedTypes.moduleID.Equals(ModuleId) Select loadedTypes.loadtype.Split(",")

which produces a string type of each value in TableB.LoadTypes. So now I would have a for loop for ChkBox.Items(types).Selected = True. But how do I convert my variable 'types' from the string to an integer?

 

 
New Post 5/9/2008 3:30 PM
User is offline toadkicker
28 posts
10th Ranked


Re: Converting comma separated values from string to integer with Linq 

Guess I have no takers?

Here it is for anyone else needing help

        Protected Sub chkListTypes_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles chkListTypes.PreRender
            Dim db As New DirectoryDataContext
            Dim Mytypes = From loadedTypes In db.TGIDirectorySettings Where loadedTypes.moduleID.Equals(ModuleId) Select loadedTypes.loadtype
            Dim items = Mytypes.Single.Split(",")
            For i As Integer = Mytypes.Count To 0 Step -1
                For Each item As String In items
                    chkListTypes.Items.FindByValue(item).Selected = True
                Next
            Next i
        End Sub

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! (Pro...  Converting comma separated values from string to integer with Linq
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DNNCovered.com - Your Offshore Dotnetnuke Partner
Dnncovered.com is the only Dotnetnuke offshore outsourcing center specializes in DNN skinning and module development with lowest pricing and quality service. Our staff is dedicated to websites based on DNN and our graphic designers are creative and imaginative well enough to provide customers the complete set of skinning solutions and packages
www.dnncovered.com
PointClick.Net DNN Solutions
DotNetNuke Hosting Platform for Business and personal use.
PointClick.Net Hosted Solutions
Advanced Web Portals by Infoscaler
Infoscaler is a California based company that provides advanced Web Portals, E-commerce Sites, Database Applications and Intranet Solutions on the DotNetNuke and Microsoft.NET platforms.
www.infoscaler.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP