How to define and use a local variable in aspx page?

Posted by Bruskvilla on Stack Overflow See other posts from Stack Overflow or by Bruskvilla
Published on 2011-01-14T13:49:38Z Indexed on 2011/01/14 13:53 UTC
Read the original article Hit count: 206

Filed under:
|

Hello how can I define a local variable in aspx page. I just did the below code it gives errors. I'm new please help. Thanks.

<% Devamsizlik.Models.DevamDurumu obj; %>

<% foreach (var item in Model){ %>
   .....blabla

 <% obj = item; %>
<%} %>//end of foreach

< p > <%: Html.ActionLink("Create New", "DevamsizEkle", new { ogrId = obj.devamOgrenciID }, new { subeId = obj.devamsizlikSubeID })%>

< / p >

....< /p> cause a compilation error Compiler Error Message: CS0165: Use of unassigned local variable 'obj'

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc