This is very similar to the solutions already provided but it's what I use. Keep in mind none of these have very good error handling and could cause problems.
<script runat="server">
bool hasChildren;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
hasChildren = ValidationHelper.GetBoolean(CMS.DocumentEngine.DocumentHelper.GetDocuments("CMS.MenuItem").NestingLevel(1).Path(Eval<string>("NodeAliasPath"), CMS.DocumentEngine.PathTypeEnum.Children).Where("DocumentMenuItemHideInNavigation = 0").Count > 0, false);
}
</script>
Then use it inline like so:
class="<%# If(hasChildren), "dropdown", "") %>"