I don't seem to be able to find a single hint at this on the Internet anywhere.

I've got an ASP.NET page with a RadioButtonList control, databound to a table in an SQL database. That works fine. I've also explicitly declared an extra "Unknown" list item, which handles any records in the database where the bound field is NULL.

However, I'd like the "Unknown" option to appear AFTER all of the other items pulled from the database. Since the property is called AppendDataBoundItems I suppose it's logical that they're going to come after any explicitly declared items, but isn't there a way to have the databound items appear first? I realise that I could achieve this by adding the "Unknown" option programmatically, but that seems like overkill!

有帮助吗?

解决方案

I realise that I could achieve this by adding the "Unknown" option programmatically, but that seems like overkill!

That's not overkill, just do that, and move on to the next part of the job.

其他提示

AppendDataBoundItems is for adding items before databinding.

See: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.appenddatabounditems.aspx

So, your only option is to do it by hand, then you have all the flexibility you need. You can insert (any position) or add items at the end of the range.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top