Thursday, May 24, 2012

Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)

I got this when i use linq query
query is below
public IQueryable<GasUtilGas> LoadAllForkliftGasUtilByDetailId(int id)
        {
            var res = from gu in db.tblForlkliftGasUtils
                      join g in db.tblGas on gu.GasID equals g.GasID
                      select new GasUtilGas { GasNo = g.GasNumber};
            return res;
        }

It seems like g.GasNumber is a nullable int field in the database.  Change the model to this:
public class GasUtilGas
    {
        public int? GasNo { get; set; }   
    }

Friday, May 11, 2012

The data source does not support server-side data paging

You can't use an IQueryable object to data bind to a GridView and still use Paging and Sorting. You must return a List to the GridView using the ToList() method. Thanks

Monday, February 20, 2012

Image upload with CKEditor.

Image upload with CKEditor.

My latest issue was how to integrate CKFinder for image upload in CKEditor. Here the solution.

1. Download CKEditor and extract in your web folder root.

2. Download CKFinder and extract withing ckeditor folder.

3. Then add references to the CKEditor, CKFinder and put
 <CKEditor:CKEditorControl ID="CKEditorControl1" runat="server"></CKEditor:CKEditorControl>
 to your aspx page.

4. In code behind page OnLoad event add this code snippet

protected override void OnLoad(EventArgs e)
{
CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
_FileBrowser.BasePath = "ckeditor/ckfinder/";
_FileBrowser.SetupCKEditor(CKEditorControl1);
}

5. Edit Confic.ascx file.

public override bool CheckAuthentication()
{
return true;
}

// Perform additional checks for image files.
SecureImageUploads = true;

Thanks

I Built a New Kind of Number Puzzle Game (And You Can Play It Free)

 For a long time, I wanted to play a mobile puzzle game that felt genuinely strategic—something that required real brainpower, skipped the a...