如何在菜单项之间增加空间 [英] How to add space between menuitems

查看:79
本文介绍了如何在菜单项之间增加空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在动态创建Menuitems.

I am dynamically creating Menuitems.

<asp:Menu ID="menuNumeric" runat="server" CssClass="pagerFont" Orientation="Horizontal" OnMenuItemClick="menuNumeric_Click" Visible="true">                                                            


//code file
protected void grVwProductionOrderSearch_OnDataBound(object sender, EventArgs e)
    {
        Menu menuNumeric = (Menu)PagerPO.FindControl("menuNumeric");
        menuNumeric.Items.Clear();


        int startIndex = ((PagerCurrentIndex / PagerDisplayCount) * PagerDisplayCount) + 1;
        int maxIndex = startIndex + PagerDisplayCount;

        for (int i = startIndex; i < maxIndex; i++)
        {
            MenuItem item = new MenuItem();
            item.Text = " " + i.ToString() + " ";
            item.Value = i.ToString();

            if (grVwProductionOrderSearch.PageIndex == i)
            {
                item.Selected = true;
                PagerCurrentIndex = i;
            }
            menuNumeric.Items.Add(item);

        }
    } 



菜单项之间没有空格
输出:12345678910

如何在菜单项之间添加空格
预期输出:1 2 3 4 5 6 7 8 9 10

谢谢



There is no space between menuitems
output: 12345678910

How to add space between menuitems
expected output: 1 2 3 4 5 6 7 8 9 10

Thank you

推荐答案

一种幼稚但可行的方法:在每对项目之间插入一个或多个&nbsp;字符(不可破坏的空格).

另一种方法是:将每个标签夹在span标记中,并可能带有class属性.在CSS中,为该垃圾邮件元素对称地提供一些margin-leftmargin-right,或者更好的两者.除了span之外,您还可以使用任何 inline HTML元素.

—SA
One naive but working approach: insert one or more &nbsp; characters (non-breakable space) between each pair of items.

Another approach is: sandwich each in span tag, possibly with class attribute. In CSS, give this spam element some margin-left or margin-right, or better both, symmetrically. Instead of span you can use any inline HTML element.

—SA


这篇关于如何在菜单项之间增加空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆