开发者

Need best approach for list in MVC1

Example: I have employee accounts detail page(view), which contains more than 1 accounts for employee. It contains almost 10 textbox and couple of dropdown box. I need to display list of accounts.

So on top part, i want to give 10 textbox and dropdown and a button named "Add to list" and below that i want to display list of accounts with Edit, delete link. Edit should populate all textbox again with values. User can make change and press "Add to list" again and values should get change. I don't need sorting, filtering......so was thinking if i can do it with normal rendering only or i need any grid widget or something............

Also, my list should only display 3-4 columns only which is partial information from all textbox and dropdown. So i might need to have other information in session or memory. Not sure how can i do this in MVC

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<thead>
    <tr>
        <th width="13%"></th>
        <th width="12%"></th>
        <th width="13%"></th>
        <th width="12%"></th>
        <th width="13%"></th>
        <th width="12%"></th>
    </tr>
 </thead>
<tbody>
    <tr>
        <td colspan="6" class="comHead"><strong>Food Nutrition Information</strong></td>
    </tr>
    <tr>
        <td><label for="txtDefaultServingSize">Serving Size: *</label></td>
        <td colspan="5">
            <%=Html.TextBox("txtDefaultServingSize", String.Format("{0:0.000}", Model.NutritionInfos[0].ServingSizeWhole), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;
            <%=Html.DropDownList("ddlDefaultServingSizeFraction", Model.NutritionInfos[0].ServingSizeFraction)%>&nbsp;&nbsp;
            <%=Html.DropDownList("ddlServings", Model.NutritionInfos[0].ServingUnits, new{ @class = "dropdownlist" } ) %>&nbsp;&nbsp;
            <%=Html.ValidationMessage("FoodUnit", "*")%>
        </td>
    </tr>
    <tr>
        <td ><label for="txtCalories">Calories: *</label></td>
        <td>
            <%=Html.TextBox("txtCalories", String.Format("{0:0.000}", Model.NutritionInfos[0].Calories.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>
        </td>
        <td class="style1"><label for="txtCaloriesFromFat">Calories from Fat:</label></td>
        <td colspan="3">
            <%=Html.TextBox("txtCaloriesFromFat", String.Format("{0:0.000}", Model.NutritionInfos[0].CaloriesFromFat.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>
        </td>
    </tr>
    <tr>
        <td class="style1"><label for="txtTotalFat">Total Fat:</label></td>
        <td>
            <%=Html.TextBox("txtTotalFat", String.Format("{0:0.000}", Model.NutritionInfos[0].TotalFat.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
        <td class="style1"><label for="txtSaturatedFat" class="">Saturated Fat:</label></td>
        <td>
            <%=Html.TextBox("txtSaturatedFat", String.Format("{0:0.000}", Model.NutritionInfos[0].SaturatedFat.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
        <td class="style1"><label for="txtTransFat" class="">Trans Fat:</label></td>
        <td>
            <%=Html.TextBox("txtTransFat", String.Format("{0:0.000}", Model.NutritionInfos[0].TransFat.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
    </tr>        
    <tr>
        <td class="style1"><label for="txtCholesterol">Cholesterol:</label></td>
        <td>
            <%=Html.TextBox("txtCholesterol", String.Format("{0:0.000}", Model.NutritionInfos[0].Cholesterol.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;mg
        </td>
        <td class="style1"><label for="txtSodium">Sodium:</label></td>
        <td colspan="3">
            <%=Html.TextBox("txtSodium", String.Format("{0:0.000}", Model.NutritionInfos[0].Sodium.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;mg
        </td>
    </tr>
    <tr>
        <td class="style1"><label for="txtTotalCarbohydrate">Total Carbohydrate:</label></td>
        <td>
            <%=Html.TextBox("txtTotalCarbohydrate", String.Format("{0:0.000}", Model.NutritionInfos[0].TotalCarbohydrates.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
        <td class="style1"><label for="txtDietaryFiber" class="">Dietary Fiber:</label></td>
        <td>
            <%=Html.TextBox("txtDietaryFiber", String.Format("{0:0.000}", Model.NutritionInfos[0].DietaryFibers.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
        <td class="style1"><label for="txtSugars" class="">Sugars:</label></td>
        <td>
            <%=Html.TextBox("txtSugars", String.Format("{0:0.000}", Model.NutritionInfos[0].Sugars.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
    </tr>
    <tr>
        <td class="style1"><label for="txtProtein">Protein:</label></td>
        <td>
            <%=Html.TextBox("txtProtein", String.Format("{0:0.000}", Model.NutritionInfos[0].Protein.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;g
        </td>
        <td class="style1"><label for="txtVitaminA">Vitamin A:</label></td>
        <td>
            <%=Html.TextBox("txtVitaminA", String.Format("{0:0.000}", Model.NutritionInfos[0].VitaminA.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;IU
        </td>
        <td class="style1"><label for="txtVitaminC">Vitamin C:</label></td>
        <td>
            <%=Html.TextBox("txtVitaminC", String.Format("{0:0.000}", Model.NutritionInfos[0].VitaminC.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;mg
        </td>
    </tr>
    <tr>
        <td class="style1"><label for="txtCalcium">Calcium:</label></td>
        <td>
            <%=Html.TextBox("txtCalcium", String.Format("{0:0.000}", Model.NutritionInfos[0].Calcium.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;mg
        </td>
        <td class="style1"><label for="txtIron">Iron:</label></td>
        <td>
            <%=Html.TextBox("txtIron", String.Format("{0:0.000}", Model.NutritionInfos[0].Iron.NutritionValue.EmptyIfZero()), new { @maxlength = "8", @style = "width: 75px; text-align:right", onkeypress = "return utility.ui.blockNonNumbers(this, event, true, false);" })%>&nbsp;&nbsp;mg
        </td>
        <td>
            <%= Html.CheckBox("IsDefaultServing:", Model.NutritionInfos[0].IsDefaultServing) %><span>&nbsp;Default Serving?</span>
        </td>
    </tr>
    <tr>
        <td colspan="6" align="right"><input type="button" value="Add To List" id="btnAddToList"/></td>
    </tr>
</tbody> 

Serving Size Unit Calories Cal Fat Total Fat 开发者_如何学JAVA Sat Fat Trans Fat Choles Sodium Total Carb " onclick="javascript:Alert('IN Progress');">Edit " onclick="javascript:Alert('IN Progress');">Delete

Serving Notes: 


Displayed as normal list with partial view

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜