0

please help,

<%= Html.ActionLink("Edit", "Edit", New With {.id = item.good_id},DBNull.Value,new With { @title="Edit", @rel="gb_page[500, 500]"})%>

I want to add html attributes in my actionlink, but it doesnt work with these error: Expression Expected

thank you

1 Answer 1

1

First, you can't use Razor in MVC2. Second, you seem to be using WebForms View Engine, so even if Razor was usable you can't mix razor with WebForms. Third, you shouldn't be using DBNull.. You probably don't need that field at all, but if you do then it should be Nothing (in VB) or null in C#.

What you want is something like this (c# syntax, i don't know the vb way, and I assume gb_page is some kind of array?):

<%= Html.ActionLink("Edit", "Edit", new { id = item.good_id , title="Edit", 
      rel=gb_page[500, 500]}) %>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer, I have tried your suggestion but without character '@' before html attribute, compiler give error response told it was anonymous.. like this : <%= Html.ActionLink("Edit", "Edit", new With{ @id = item.good_id , @title="Edit", @rel="gb_page[500, 500]"}) %> it almost complete but still error, it told 'Expression expected'. please help..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.