小编Ali*_*jum的帖子

回发后防止 Bootstrap 折叠切换

我在我的项目中使用 bootstrap 折叠,在那个折叠中我有一些按钮和下拉菜单,但是当我点击任何按钮或更改下拉索引时,发生回发并且折叠没有折叠,我怎么能阻止这个?这是我的代码

 <h4><a href="#" data-toggle="collapse" data-target="#div_search" style="font-weight: bold;">Search Training Profile</a><br />
                </h4>
                <div id="div_search" class="collapse" style="overflow-x: auto;">
                    <table class="table table-bordered table-striped">
                        <tr>
                            <td>Employee Name</td>
                            <td>
                                <asp:TextBox runat="server" ID="txt_name"></asp:TextBox>
                                <span class="err">optional</span>

                            </td>
                            <td>e.g First Name, Middle Name, Last Name</td>
                        </tr>
                        <tr>
                            <td>Designation</td>
                            <td><span class="err"></span>
                                <asp:DropDownList runat="server" ID="DDL_Desig" OnSelectedIndexChanged="DDL_Desig_SelectedIndexChanged" AutoPostBack="true">
                                </asp:DropDownList>
                                <span class="err">optional</span>
                            </td>
                            <td>
                                 <asp:TextBox runat="server" ID="txt_desig" ReadOnly="true"></asp:TextBox>
                                <asp:Button Text="Clear" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>Location</td>
                            <td>
                                 <asp:DropDownList runat="server" ID="DDL_Loc" OnSelectedIndexChanged="DDL_Loc_SelectedIndexChanged" AutoPostBack="true">
                                    <asp:ListItem>Select</asp:ListItem>
                                </asp:DropDownList>
                                <span class="err">optional</span>
                                </td>

                            <td>
                                 <asp:TextBox runat="server" …
Run Code Online (Sandbox Code Playgroud)

asp.net twitter-bootstrap

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

如何检查动态创建的复选框是否选中?

我在表格标题行中创建了一些动态复选框。

如果复选框被选中,表格将有另一行带有文本框。

复选框更改事件触发得很好但是当我尝试检查复选框是否被选中时,它会生成异常:

你调用的对象是空的。

这是我的代码:

在此处创建动态控件:

 TableRow thead = new TableRow();
 for (int i = 0; i < dt_fundtype.Rows.Count; i++)
 {
     TableCell td = new TableCell();
     CheckBox chk = new CheckBox();
     chk.ID = "fund_" + dt_fundtype.Rows[i]["fund_type_cd"];
     chk.Text = dt_fundtype.Rows[i]["fund_type"].ToString();
     chk.AutoPostBack = true;
     chk.CheckedChanged += new EventHandler(Chk_Fund_CheckedChange);
     td.Controls.Add(chk);
     thead.Cells.Add(td);
 }
 tbl_fundtype.Rows.Add(thead);
Run Code Online (Sandbox Code Playgroud)

复选框选中更改事件:

public void Chk_Fund_CheckedChange(object sender, EventArgs e)
{
     TableRow tr = new TableRow();
     for (int i=0;i<tbl_fundtype.Rows[0].Cells.Count;i++)
     {
         string DynamicChkID ="fund_"+ dt_fundtype.Rows[i]["fund_type_cd"].ToString();
         CheckBox chk = new CheckBox();
         chk = (CheckBox)tbl_fundtype.Rows[0].Cells[i].FindControl("DynamicChkID");
         if …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

5
推荐指数
1
解决办法
4845
查看次数

赋值应用于变量

任何人都知道为什么在 javascript 中这有效

m = Math.max
m.apply(null, [1,2,3])
Run Code Online (Sandbox Code Playgroud)

但这不是吗?

m = Math.max.apply
m(null, [1,2,3])
Run Code Online (Sandbox Code Playgroud)

它抛出异常:

TypeError:Function.prototype.apply 在 undefined 上被调用,这是一个 undefined 而不是一个函数

javascript apply

5
推荐指数
1
解决办法
237
查看次数

使用 Java Script 在 Google Map 上的多个标记之间画线

我正在尝试在 Google 地图上的多个标记之间画线。多个标记的绘制是成功的,但是我无法绘制多条线。

我试过下面的代码只画了一条线:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&callback=map_init"></script>
    <script type="text/javascript">
        function InitializeMap() {
            var ltlng = [];

            ltlng.push(new google.maps.LatLng(17.22, 78.28));
            ltlng.push(new google.maps.LatLng(13.5, 79.2));
            ltlng.push(new google.maps.LatLng(15.24, 77.16));

            // var latlng = new google.maps.LatLng(-34.397, 150.644);
            var myOptions = {
                zoom: 8,
                //center: latlng,
                center: ltlng[0],
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("map"), myOptions);

            for (var i = 0; i < ltlng.length; i++) {
                var marker = new google.maps.Marker
                    (
                    {
                        // position: new google.maps.LatLng(-34.397, 150.644),
                        position: ltlng[i],
                        map: map,
                        title: 'Click me' …
Run Code Online (Sandbox Code Playgroud)

html javascript asp.net google-maps

5
推荐指数
1
解决办法
8147
查看次数

输入每个字符后,使密码文本框值可见

我有一个密码字段:

 <input class="form-control" type="password" name="password" required="required" />
Run Code Online (Sandbox Code Playgroud)

自然,当用户输入密码时,默认为*****模式,

但是我想在此字段中添加一些其他内容,这意味着当用户从密码输入任何字符时,它应该显示一段时间,然后将其转换为***。

我在Iphone中看到这件事,当用户输入密码时,当前输入的字符会显示一段时间,然后将其转换为****。如何在.net应用程序中执行此操作?请有人帮助我提前解决此问题。

html javascript c# asp.net jquery

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

将日期格式更改为ddth mmm,yyyy

我正在我的网络表单上打印一些日期.目前我的日期格式是dd:mmm:yyyy hh:mm

如何将日期格式更改为ddth mmm,yyyy for示例2016年5月17日 hh:mm

这是我的代码:

 lastlogin = DateTime.Parse(dt_LastLoginDetail.Rows[0]["login_time"].ToString());
 lastlogindate = "Last Login Date: " + lastlogin.ToString("dd-MMM-yyy hh:mm tt");
Run Code Online (Sandbox Code Playgroud)

c# datetime string-formatting datetime-format

4
推荐指数
1
解决办法
1535
查看次数

无法为LINQ选择的数据分配新值

namespace ConsoleApplication4
{
    class T1
    {
        public int MyProperty { get; set; }
    }
    class Program
    {
        static void Main(string[] args)
        {
            var tmp = (new[] { 1, 3, 4 }).Select(x =>new T1 { MyProperty=x});
            foreach (var s in tmp)
            {
                s.MyProperty = 9;
            }
            foreach (var s in tmp)
            {
                Console.WriteLine(s.MyProperty);
            }
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我预计屏幕上有三个9,但值仍然相同.

但是,如果我稍微修改代码,则值将成功更改,即:

var tmp = (new[] { 1, 3, 4 }).Select(x =>new T1 { MyProperty=x}).ToList();
Run Code Online (Sandbox Code Playgroud)

我想知道为什么?

c# linq foreach select

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

getElementById神秘地返回URL

我有一个函数,它将thumbnail路径作为值,等待引导模式打开,然后将thumbnail href模态内的值设置为正确的路径.

然而,当我console.logelement(el),我得到的页面即网址

Element is http://localhost:8086/project/etc/etc
Run Code Online (Sandbox Code Playgroud)

我错过了一些明显的东西或做些傻事吗?

  function addThumbnailPathToModal(thumbnailPath) {
      $('#my-modal').on('show.bs.modal', () => {
        const el = document.getElementById('thumbnail');
        console.log(`Element is ${el}`)
        el.setAttribute('href', thumbnailPath);
      })
    }

$('.something').on('click', '.open-modal', () => {
  const thumbnailPath = getThumbnailPathFromAttribute();
  addThumbnailPathToModal(thumbnailPath);
  $('#my-modal').modal();
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap

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