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

[Solved] Javascript error in Gird Question

1 Answer 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 17 Aug 2011, 04:11 PM
When i run this code:
    <% Html.Telerik().Grid<BuyOffersTable>()
        .BindTo(Model)
        .DataKeys(datakeys => datakeys.Add(c => c.BuyOfferGUID))
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_BuyOffersTablesBinding", "BuyLetters"))
        .Name("BuyOffersTable")
        .Columns(columns =>
                    {
                        columns.Bound(o => o.BuyOfferGUID).Hidden(true);
                        columns.Bound(o => o.BuyOfferGUID).ClientTemplate("<a href='" + Url.Action("BuyLetters") + "/<# BuyOfferGUID #>Select</a>")
                        .Template(o => { %><%=Html.ActionLink("B"+o.BuyOfferNumer, "BuyLetters", new { id = o.BuyOfferGUID })%><% }).Title("");
                        columns.Bound(o => o.BuyOfferNumer).ClientTemplate("B<# BuyOfferNumer #>").Template(o => { %>B<%=o.BuyOfferNumer%><% }).Title("Offer #");
                        columns.Bound(o => o.Createdate).Title("Created");
                        columns.Bound(o => o.FirstName).Title("First Name");
                        columns.Bound(o => o.LastName).Title("Last Name");
                    })
                    .Sortable()
                    .Scrollable()
                    .Pageable()
                    .Render();
 
%>

I get an error vs shows as asset.axd file on this line:
return new Function("data",("var p=[];with(data){p.push('"+unescape(l).replace(/[\r\t\n]/g," ").replace(/'(?=[^#]*#>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g,"',$1,'").split("<#").join("');").split("#>").join("p.push('")+"');}return p.join('');"))

it gives me this error :
Microsoft JScript runtime error: Expected ';'

Not sure what I need to do to fix this, Please Help




1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 17 Aug 2011, 04:21 PM
Hi David,

It seems that you are missing the equal sign in the client templates declaration:

columns.Bound(o => o.BuyOfferGUID).Hidden(true);
columns.Bound(o => o.BuyOfferGUID).ClientTemplate("<a href='" + Url.Action("BuyLetters") + "/<#= BuyOfferGUID #>Select</a>");
columns.Bound(o => o.BuyOfferNumer).ClientTemplate("B<#= BuyOfferNumer #>");

Regards,
Rosen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or