在 telerik:RadGrid 内设置 telerik:GridDropDownColumn 的默认值
我有一个绑定到 SQL 数据源的 telerik:RadGrid。其中一列用于“位置”,它实际上是另一个表中的查找值。
<telerik:GridDropDownColumn
DataField="d_location_id"
DataSourceID="dsLocation"
UniqueName="d_location_id"
DataType="System.Int32"
ListValueField="d_location_id"
ListTextField="Abbreviation"
HeaderText="Location">
</telerik:GridDropDownColumn>
我的位置列表存储在 ObjectDataSource 中,它绑定到静态 DataTable 并已按字母顺序排序。我想做的是能够为此下拉菜单设置默认选项。
例如,假设我有以下位置:
1 Home
2 Work
3 Parents
4 Car
我希望将“Parents”作为我的默认值。
Telerik 上的此示例显示了类似于以下内容的内容我正在努力做。如果您单击“添加新记录”,您会注意到默认城市是柯克兰,我正在尝试弄清楚在添加新记录时如何使用伦敦作为默认城市。
I have a telerik:RadGrid that is bound to a SQL Data Source. One of the columns is for "Location" which is really a look up value in another table.
<telerik:GridDropDownColumn
DataField="d_location_id"
DataSourceID="dsLocation"
UniqueName="d_location_id"
DataType="System.Int32"
ListValueField="d_location_id"
ListTextField="Abbreviation"
HeaderText="Location">
</telerik:GridDropDownColumn>
My list of locations is stored in an ObjectDataSource, which is bound to a static DataTable and sorted alphabetically for me already. What I would like to do is be able to set the default option for this dropdown.
For example, suppose I have the following locations:
1 Home
2 Work
3 Parents
4 Car
I would like to have Parents be my default value.
This sample on Telerik shows something similar to what I'm trying to do. If you click "Add New Record", you'll notice the default city is Kirkland and I'm trying to figure out how to use London as the default when adding a new record.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否是最好或最直接的方法,但它确实有效。
Not sure if it is the best or most straightforward way or not, but it does work.