Convert string to int

1 posts, 0 answers
  1. Chris
    Chris avatar
    120 posts
    Member since:
    Jun 2006

    Posted 07 Oct 2009 Link to this post

    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
                Label1.Text = (q != null) ? q.Title : "Not Found";
                Image1.ImageUrl = q.ImageURL;
Back to Top