2013-08-16 60 views
0

我有一個10列數據庫中的表,這10列是網頁中的輸入字段。現在,基於某些正在訪問網頁的用戶類型,我只需要顯示特定的字段,並且還需要更改這些字段在網頁中顯示的順序。我可以顯示或隱藏輸入字段,但我不確定如何根據特定條件重新排序輸入字段。是否有可能在服務器端使用asp.net做一些事情,或者我需要使用jQuery嗎?我們該如何實現這一目標?如何在Asp.net Web表單中創建動態UI

+0

嘗試用asp.net數據控制,如網格,並使用綁定文本框,並改變字符串的順序作爲代碼所需要的背後 – Sunny

回答

1

沒有看到任何你的代碼,如果你連有什麼的話,我會建議的東西沿着這些路線:

有查詢數據條件邏輯,基於用戶類型(讀:角色),像這樣:

switch (user.Role) 
{ 
    case "Customer": 
     // Call customer stored procedure to return data pertinent to Customers 
     // Returns List<T>, DataSet, DataTable, etc. 
     break; 
    case "Admin": 
     // Call admin stored procedure to return data pertinent to Admins 
     // Returns List<T>, DataSet, DataTable, etc. 
     break; 
    case "SuperUser": 
     // Call super-user stored procedure to return data pertinent to Super Users 
     // Returns List<T>, DataSet, DataTable, etc. 
     break; 
} 

// Apply the data structure (List<T>, DataSet, DataTable, etc.) to your display, like this: 
GridView.DataSource = dataSource; 
GridView.DataBind(); 
+0

但所有這些列網頁的DataEntry領域,如文本框複選框等.....現在我想根據條件改變這個輸入控件的順序................ – 09999