2011-08-22 41 views
1

例如: 我有員工賬戶詳細信息頁面(查看),其中包含員工超過1個賬戶。它包含幾乎10個文本框和幾個下拉框。我需要顯示帳戶列表。需要MVC1中列表的最佳方法

因此,最重要的是,我想給10個文本框和下拉列表和一個名爲「添加到列表」,並在下面,我想顯示編輯,刪除鏈接帳戶列表的按鈕。編輯應該使用值再次填充所有文本框。用戶可以進行更改並再次按「添加到列表」,值應該改變。我不需要排序,過濾......所以想着如果我可以用普通渲染來做到這一點,或者我需要任何網格小部件或什麼............

另外,我的列表應該只顯示3-4列,這是所有文本框和下拉菜單中的部分信息。所以我可能需要在會話或內存中有其他信息。不知道我怎樣才能在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> 

份量 單位做到這一點 卡路里 卡爾脂肪 總脂肪 飽和脂肪 反式脂肪 Choles 鈉 碳水化合物總量 「的onclick =」 JavaScript的:警報( '正在執行'); 「>編輯 」 的onclick = 「JavaScript的:警報( '正在執行');」>刪除
服務注: 
+0

我還沒有嘗試過任何尚未 – jvm

+1

聽起來像是你想讓別人來完成所有的工作,然後。嘗試一下,然後回來問一個問題,以確定你是否無法使用它。 = D – Tejs

+0

只要正確閱讀問題Tejs,我問最好的辦法不是解決方案 – jvm

回答

0

顯示爲局部視圖普通列表

相關問題