문제

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