ola pessoal
estou criando um custon helper,
criei o arquivo CustonHelper na pasta app_data e fiz um metodo de teste e funcionou.
fui fazer o segundo teste, porem, teste necessita de uma de dados de uma classe e ai que comecou meu problemas.
inicialmente ele dava erro no metodo @Html.DropDownList que era o seguinte "The best overloaded method match for 'System.Web.WebPages.Html.HtmlHelper.DropDownList(string, System.Collections.Generic.IEnumerable<System.Web.WebPages.Html.SelectListItem>)'
has some invalid arguments"
porem, nao se tratava de erro, ate por que eu o utilizo em outro lugar igual.
descobri que eu tinha que importar algumas bibliotecas e o fiz, seguem a bibliotecas
@using System.Text;
@using System.Collections.Generic;
@using System.Web.Mvc;
@using WebMatrix.Data;
@using WebMatrix.WebData;
porem, quando eu faco isso, ele nao reconhece mais a classe "CategoryModel()", entao fiz a chamada direta dela "PresentationWebLayer.Models.CMS.CategoryModel().GetSelectListItem();" e parou de funcionar de novo o " @Html.DropDownList"
a questao é, se importo um o outro nao funciona, nao entendo esse tipo de conflito! :(
estou postando o codigo completo da CustonHelper
@using System.Text;
@using System.Collections.Generic;
@using System.Web.Mvc;
@using WebMatrix.Data;
@using WebMatrix.WebData;
@helper SelectMenu()
{
var selectListItem = new PresentationWebLayer.Models.CMS.CategoryModel().GetSelectListItem();
<label for="categoryID">Categoria @Html.DropDownList("categoryID", selectListItem) </label>
}
lembrando que faco a seguinte chamada direta na view
<label for="categoryID">Categoria</label> @Html.DropDownList("categoryID", categoryModel.GetSelectListItem())
e funciona perfeitamente.
abs
Carlos Eduardo Barbosa
Analista de Sistema
Business Intelligence
WEB Intelligence
carlos.ed.b@hotmail.com
@carlos_ed_b
Mercúrio – Comunicação Digital