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;
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;