C# 如何使用jquery mobile在mvc中使用@Html.ActionLink创建计数气泡

C# 如何使用jquery mobile在mvc中使用@Html.ActionLink创建计数气泡,c#,jquery,asp.net-mvc,asp.net-mvc-4,C#,Jquery,Asp.net Mvc,Asp.net Mvc 4,我用jquery mobile在mvc4中创建了计数气泡按钮。以下代码 <a href="url.html" class="ui-li-has-count" data-role="button" data-ajax="false" data-mini="true" style="background-color:#52616D;color:white"> DK-02<span class="ui-li-count ui-btn-up-c ui-btn-corner-all"

我用jquery mobile在mvc4中创建了计数气泡按钮。以下代码

<a href="url.html" class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
 DK-02<span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color:white;color:#52616D">11</span></a>
已更新

在你们的帮助下,我解决了80%的问题。我所做的是

<div class="ui-grid-c">
    @for (int j = 1; j < myPutaway.Count + 1; j++)
    {
        if **(j == 1)**
        {
        <div class="ui-block-a">
            <a href="@Url.Action("test", "DirectPutaway")" class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
                @myPutaway[j].ReceivingLane.ToString() <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color: white; color: #52616D">@myPutaway[j].NoOfMuf.ToString() </span></a>
        </div>
        }
        else if **(j == 2)**
        {
        <div class="ui-block-b">
            <a href="@Url.Action("test", "DirectPutaway")" class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
                @myPutaway[j].ReceivingLane.ToString() <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color: white; color: #52616D">@myPutaway[j].NoOfMuf.ToString()</span></a>
        </div>
        }
        else if **(j == 3)**
        {
        <div class="ui-block-c">
            <a href="@Url.Action("test", "DirectPutaway")" class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
                @myPutaway[j].ReceivingLane.ToString() <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color: white; color: #52616D">@myPutaway[j].NoOfMuf.ToString()</span></a>
        </div>
        }
        else if **(j == 4)**
        {
        <div class="ui-block-d">
            <a href="@Url.Action("test", "DirectPutaway")" class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
                @myPutaway[j].ReceivingLane.ToString() <span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color: white; color: #52616D">@myPutaway[j].NoOfMuf.ToString()</span></a>
        </div>
        }
    }
</div>

@对于(int j=1;j


我知道了,但我硬记录了j==1,2,3,4来设置css类,,,它需要显示4*4网格。但我不想硬记录如何让它充满活力。因此,我的第一个值将获得A类和第二个B类。etc

您必须使用@Url.Action将Url放入
A
href属性中:

<a href='@Url.Action("test","home")' class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
DK-02
<span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color:white;color:#52616D">11</span>
</a>

或者,如果您只想使用Html助手方法,那么您必须编写自己的自定义Html助手


你可以在这里看到如何创建,你的实际问题是什么:设置属性,创建嵌套的
或者为
a
元素设置URL?@AndreiV:请查看我更新的博文bro.dude谢谢。你解决了我80%的问题。请参阅更新后的帖子。我在等你的答复。
<a href='@Url.Action("test","home")' class="ui-li-has-count" data-role="button"  data-ajax="false" data-mini="true" style="background-color:#52616D;color:white">
DK-02
<span class="ui-li-count ui-btn-up-c ui-btn-corner-all" style="background-color:white;color:#52616D">11</span>
</a>