說我們有這個結構分貝,幾乎沒有性能。所有屬性,它們的名稱,默認值,描述和類型(字符串,整數,日期時間)在一個表(attributeDefinition)中定義,並且所有值都存儲在另一個表中。如何建立在asp.net自定義屬性編輯器(Web表單)
Cars (Id, Name)
AttributeDefinition(AttributeDefinitionId, Type, Name, Desctiption, MaxValue, ...)
AttributesValues (AttributeDefinitionId, CarId, Value)
現在我想爲Cars屬性創建一個通用編輯器。
的問題是,我應該怎麼實現這一點?是否有一些可以處理這個問題的控件,有沒有類似的其他工具?
或者我應該是這樣的:
// In MyPropertyEditor.ascx load
// Iterate over all attributes in attributedefinition
// add TextBox, NumberEditor or DateTimePicker,
// give them som good names
// End
//
// In Save, iterate over all controls again, and save back
上午我在正確的方向前進嗎?
我想有關DataGrid,以及它是如何產生的飛行中的所有列。我希望我能做類似的事情?
感謝您的幫助在Visual Studio中
問候
Larsi
我不認爲這是一個控制,會爲你做這自動,你最好的選擇將是使用動態SQL存儲過程(請記住,使用sp_excecutesql與參數,以防止SQL注入),或者你將不得不在代碼中創建自己的數據表,它看起來不會超過10分鐘左右? – 2011-05-09 14:30:21