Click here to Skip to main content
12,884,261 members (30,032 online)
Rate this:
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">
     <td align="left">
         <%if (result.EditableTextBox == true) %>
             <%{ %>
              <%:Html.TextBox("", "", new { ID="txtEditre"})%>
              <%} %>
              <%else %>
                <%{ %>
              <%} %>
 <% }
   } %


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.

Posted 13-Aug-12 0:02am

1 solution

Rate this: bad
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"})%>]]>

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170422.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2017
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