Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC3
Hi Friends,
 
I want to genrate the text boxes dynamiclly.
and I am using MVC 3
 
i did the code which is as follows
 
<% foreach (var result in Model)
    { %>
 <tr bgcolor="#ffeadf">
     <td align="left">
         <%=result.ShowYear%>
     </td>
     <td align="left">
         <%if (result.EditableTextBox == true) %>
             <%{ %>
              <%:Html.TextBox("", "", new { ID="txtEditre"})%>
 
              <%} %>
              <%else %>
                <%{ %>
               <%=result.ShowProjectRevenu%>
              <%} %>
     </td>
 </tr>
 <% }
   } %
>
 

the above code is the partial view code.
how to get the id and the value of that text box.
it is giving error that the value and the string name could not be null.
 
please help me i have tries googling but not getting the right way to solve it.
 
Thanks
Posted 13-Aug-12 0:02am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The first parameter og Html.TextBox is the name (cannot be null or string.Empty.
 
<![CDATA[<%:Html.TextBox("txtEditre", "", new { ID="txtEditre"})%>]]>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 389
1 Sergey Alexandrovich Kryukov 375
2 Maciej Los 295
3 King_Fisher 160
4 Garth J Lancaster 158
0 Sergey Alexandrovich Kryukov 11,069
1 OriginalGriff 5,743
2 Maciej Los 5,649
3 CPallini 3,879
4 BillWoodruff 3,584


Advertise | Privacy | Mobile
Web04 | 2.8.141030.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100