小编Inf*_*und的帖子

幻灯片放映与引导程序

我尝试使用引导程序制作幻灯片,以便您滑动图像.但图像没有显示.仅显示下一个和上一个按钮.我使用的是asp.net mvc5

这是jquery:

$(document).ready(function () {
            $myModal = $('#myModal');

            $('.row img.img-responsive').on('click', function () { // <-- notice the selector change
                var $this = $(this),
                    src = $this.attr('src'),
                    html = '<img src="' + src + '" class="img-responsive" />';

                //Start 
                var index = $(this).parent('.row img.img-responsive').index();
                var html = '';
                html += html;
                html += '<div style="height:25px;clear:both;display:block;">';
                html += '<a class="controls next" href="' + (index + 2) + '">next &raquo;</a>';
                html += '<a class="controls previous" href="' + (index) + '">&laquo; prev</a>';
                html += …
Run Code Online (Sandbox Code Playgroud)

css jquery html5 twitter-bootstrap

7
推荐指数
1
解决办法
988
查看次数

编写分页的通用方法

我有控制器,其中将计算分页.但我有13个不同的控制器.因此,在每个控制器中编写计算将是乏味的.

这是comoplete方法:

 [Route("sort/{SortColumn}/{SortOrder?}", Name = "Sort-Product")]
        [Route("page/{Page:int}/{SortColumn}/{SortOrder?}", Name = "Paging-Product")]
        [Route("search/{SearchString}")]
        [Route("index")]
        public ActionResult Index(string searchString, string filter, string currentFilter, string sortColumn, string sortOrder, int? page)
        {
            IOrderedQueryable<Product> entities = (IOrderedQueryable<Product>)db.FilteredProducts;

            if (searchString != null) page = 1; else searchString = currentFilter;

            if (filter != null) {
                string[] filters = filter.Split(new char[] { '.' });
                filter = "";

                // filter on form
                if (filters.Length > 0 && !String.IsNullOrEmpty(filters[0])) {
                    FormLibraryEntry formEntry = FormLibraryController.GetFormLibraryEntry(filters[0], StateHelper.GetSchema());

                    if (formEntry != null) {
                        entities …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc

6
推荐指数
1
解决办法
775
查看次数

如何从textfield中的datepicker获取值

我有一个日期选择器,您可以在文本字段中选择数据和日期.但是textfield中的值是空的,那么如何在textfield中获取值呢?这是文本字段:

<input name="form_inp1" title="" class="xforms-input xforms-control qmatic-dateslot xforms-incremental xforms-ap-default hasDatepicker" id="form_inp1" type="text" x-incremental="1" value=""/>
Run Code Online (Sandbox Code Playgroud)

这是datepicker的脚本:

inp.datepicker({
     dateFormat: dateFormat,
     beforeShowDay: function (date) {
         var dt = $.datepicker.formatDate('yy-mm-dd', date)
         return [$('#form_one3 > option:gt(0)[value="' + dt + 'T00:00:00Z"]').length != 0];
     },  
     changeMonth: true,
     changeYear: true,
     showWeek: true,
     firstDay: 1,
     yearRange: "c-100:c+15",
     showOn: inp.hasClass("ui-date-picker-onfocus") ? "focus" : "button"
})
Run Code Online (Sandbox Code Playgroud)

谢谢

我现在这样:

; (function ($) {
    $(function () {
        $("form.xforms-form").bind({
            XForms_Enrich: function (e) {
                if ($.fn.datepicker) {
                    $("input.qmatic-dateslot", e.args.data).each(function () {
                        var inp = $(this); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery datepicker

5
推荐指数
2
解决办法
3万
查看次数

Tinymce 获取内容

我尝试获取tinymce的内容,如下所示:

 var hallo = tinyMCE.activeEditor.getContent();
            alert(hallo);
Run Code Online (Sandbox Code Playgroud)

但每次我收到这条消息时:

Uncaught TypeError: Cannot read property 'getContent' of null
Run Code Online (Sandbox Code Playgroud)

我正在使用 tinymce 4。

谢谢

javascript jquery tinymce

2
推荐指数
2
解决办法
1万
查看次数

剃刀的奇怪错误

我有这个:

<tr class="@(item.Id == (int)(Session["Id"] ?? 0) ? 
   "sfs-selected sfs-selectable" : String.Empty)">
Run Code Online (Sandbox Code Playgroud)

但我得到了这个meesage:

operator '==' cannot be applied to operands of type 'method group' and 'int'
Run Code Online (Sandbox Code Playgroud)

但我已经投了int.

如果我这样做:

 <tr class="@if (item.Id == (string)(Session["id"] )) {@("sfs-selected sfs-selectable") } @string.Empty ">
Run Code Online (Sandbox Code Playgroud)

然后我收到这个错误:

Unable to cast object of type 'System.Int32' to type 'System.String'.
Run Code Online (Sandbox Code Playgroud)

那么如何检查空值?

谢谢

如果我这样做:

 <tr class="@(item.Id == (Session["Id"] ?? 0) ? "sfs-selected sfs-selectable" : String.Empty)">
Run Code Online (Sandbox Code Playgroud)

我收到这个警告:

错误警告:可能的意外参考比较; 得到一个值比较,右侧输入'string'

所以我这样做:

<tr class="@(item.Id == (string)(Session["Id"] ?? 0) ? "sfs-selected sfs-selectable" : String.Empty)">
Run Code Online (Sandbox Code Playgroud)

然后我明白了: …

c# asp.net-mvc

0
推荐指数
1
解决办法
142
查看次数

通过阅读字符跳过空白区域

我想跳过字符之间的空格.例如,我有这个:

abc def ghi,那么输出必须是:

a = 1
b = 1
c = 1..etc
Run Code Online (Sandbox Code Playgroud)

但现在我得到:

"" = 2.
Run Code Online (Sandbox Code Playgroud)

因为角色之间有两个空格.

我试试这样:

SortedDictionary<char, int> dictionary = new SortedDictionary<char, int>();

Console.WriteLine("Enter a string: "); // prompt for user input
string input = Console.ReadLine(); // get input

// split input text into tokens
char[] letters = Regex.Split(input.ToCharArray().ToString(), @"\s+");
Run Code Online (Sandbox Code Playgroud)

c#

-2
推荐指数
1
解决办法
630
查看次数