Erro Video-Aula 47 Aplicação Web de Classificados

21/02/2012

0

Olá Colegas,

Está dando o seguinte erro abaixo ao seguir a video-aula 47 do Henryll. Se algum colega puder me ajudar eu agradeço:


Server Error in / Application.
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 49: private void populargvAnuncios()
Line 50: {
Line 51: var secaoSelecionada = int.Parse(ddlSecoes.SelectedValue);
Line 52: var anuncios = BLL.AnunciosBLL.ListarSecao(secaoSelecionada);
Line 53: gvAnuncios.DataSource = anuncios.ToList();


Source File: D:\Projetos\_Net\Classificados\Classificados.Web\Anuncios.aspx.cs Line: 51

Stack Trace:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9591163
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
System.Int32.Parse(String s) +23
Classificados.Web.Anuncios.populargvAnuncios() in D:\Projetos\_Net\Classificados\Classificados.Web\Anuncios.aspx.cs:51
Classificados.Web.Anuncios.ddlSecoes_SelectedIndexChanged(Object sender, EventArgs e) in D:\Projetos\_Net\Classificados\Classificados.Web\Anuncios.aspx.cs:45
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +118
System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +143
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +10
System.Web.UI.Page.RaiseChangedEvents() +134
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5201


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Hugo

Hugo

Responder

Posts

21/02/2012

Hugo

Pessoal, está resolvido com a ajuda do Henryllemaia.

Eu tentei colocar um valor padrão no meu DropDownlist, que não deu certo e ainda por cima prejudicou a minha aula de número 47.

Infelizmente tive que omitir essa minha rotina. Desta forma a aplicação funcionou perfeito.


Abs,
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar