This is a migrated thread and some comments may be shown as answers.

Convert string to int

0 Answers 109 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 08 Oct 2009, 01:59 AM
I am having an issue with a conversion.  I have a Telerik RadMenu loading via a Linq to Sql class.  I am then trying to invoke a onclick event on a menu item.  I am trying to pass the menu item field id as a parameter. See code below.

The problem is, the idProjects is an int and @linkId is a string.  I get an error that says @linkId cannot be implicitly converted from a string to an int. How can i make this work?



            string linkId = RadMenu1.DataFieldID.ToString();

            SundownDataContext dc = new SundownDataContext();
            var q = (from projects in dc.GetTable<ProjectImage>()
                     where projects.idProjects = @linkId
                     select new
                     {

                         Title = projects.projTitle,
                         ImageURL = projects.projImage
                     }).FirstOrDefault();
            Label1.Text = (q != null) ? q.Title : "Not Found";
            Image1.ImageUrl = q.ImageURL;

No answers yet. Maybe you can help?

Tags
Menu
Asked by
Chris
Top achievements
Rank 1
Share this question
or