Click here to Skip to main content
11,925,246 members (55,193 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 1: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
Web04 | 2.8.151125.3 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2015
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