小编Ama*_*ian的帖子

从发件人获取GridView对象

GridView在一个页面上有多个页面,它们都是分页的。我需要处理OnPageIndexChanging事件中的分页,但是我不想为每个脚本编写相同的代码GridView

那么如何从发送方获取GridView对象ID?我正在尝试执行以下操作...。

protected void PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView gridView = (GridView)sender.ID;

    gridView.PageIndex = e.NewPageIndex;
    gridView.DataBind();
}
Run Code Online (Sandbox Code Playgroud)

这样,我可以为所有GridView调用相同的事件处理程序,而不必为每个GridViews编写一个新的偶数处理程序?我只是不知道如何获取ID的的GridView触发事件:(

任何帮助表示赞赏!

c# asp.net events sender page-index-changed

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

如何在移动网络上使用CSS,Java Script创建半圆菜单(子项)?

当我用右手冲浪移动网络时,我想使用半圆菜单.

有人可以教我如何用CSS,Java Script在移动网络上创建半圆菜单(子项)吗?

照片链接:

1.有一个半圆菜单按钮,可以打开和关闭.

在此输入图像描述

2.当我单击其中一个主要项目时,子项目可以下拉.

在此输入图像描述

真诚的感谢.

html javascript css geometry menu

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

CSS,文字装饰:上线

我正在尝试使用css在悬停时创建一个上线效果.我到目前为止的内容如下.这是我遇到的问题,在线直接出现在文本上方.我希望它们有一些空间.这是我的网站:http://baycity2014.weebly.com,这是我想要的效果:http://www.hartlevin.com.有什么建议?

CSS:

#nav-wrap .container {
    clear: both;
    overflow: hidden;
    position: relative;
}

#nav-wrap .container {
    /*background:url(nav-bg-medium.jpg) repeat-x top;*/
    /*height:45px;*/
}

#nav-wrap .container ul {
    list-style: none;
}

#nav-wrap .container ul li {
    list-style: none;
    float: left;
    /* background:url(nav-saperator-medium.jpg) no-repeat right;*/
    padding-right:2px;
}

#nav-wrap .container ul > li:first-child a,
#nav-wrap .container ul > li:first-child a:hover,
#nav-wrap .container ul span:first-child li a,
#nav-wrap .container ul span:first-child li a:hover{
    border-radius:5px 0px 0px 5px;
}

#nav-wrap …
Run Code Online (Sandbox Code Playgroud)

html css

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

如何在wordpress中检索和显示图像的替代文字?

如何在wordpress中检索和显示图像的替代文字?试图用标题代替 alt。这是原始代码。

<?php while ( have_posts() ) : the_post(); ?>

  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
   <header class="entry-header">
    <h1 class="entry-title"><?php the_title(); ?></h1>
Run Code Online (Sandbox Code Playgroud)

所以在 h1 我想要:

<h1 class="entry-title">"alt text of image"</h1>
Run Code Online (Sandbox Code Playgroud)

试着把它放在一个像这样的变量中:

 $alt_text = get_post_meta($img_id , '_wp_attachment_image_alt', true);
<h1 class="entry-title"><?php echo $alt_text; ?></h1>
Run Code Online (Sandbox Code Playgroud)

但它没有出现。任何解决方案?

php wordpress image alt

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

GridView PageIndexChanging不起作用

这似乎是一个容易提出的问题,但我无法在GridView中显示项目.这是我的代码:

 public partial class TestList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {   TestProject.DataAccess.Repository.Instance.Initialize(Settings.Default.TestConnection);
            BindData();
        }

    }

    private void BindData()
    {
        //Restriction Info!!
        gvAgentList.DataSource = EntityRegistration.DataAccess.Repository.Instance.GetData();
        gvAgentList.DataBind();
    }

   protected void gvAgentList_PageIndexChanging (object sender, GridViewPageEventArgs e)
    {

        gvAgentList.PageIndex = e.NewPageIndex;
        gvAgentList.DataBind();
    }

   private string ConvertSortDirectionToSql(SortDirection sortDirection)
   {
       string newSortDirection = String.Empty;

       switch (sortDirection)
       {
           case SortDirection.Ascending:
               newSortDirection = "ASC";
               break;

           case SortDirection.Descending:
               newSortDirection = "DESC";
               break;
       }

       return newSortDirection;
   }

   protected void gvAgentList_Sorting(object sender, GridViewSortEventArgs e) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net gridview page-index-changed

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

jquery在mvc中填充下拉列表

我正在尝试填充一个下拉列表,但我仍然对 J 查询感到非常困惑,因为我对它很陌生。

这是我的代码:

在控制器中:

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult GetTeams(StatisticModel model)
    {
        StatisticModel newModel = new StatisticModel(model.leagueId);
        var teams = newModel.getTeams;
        return Json(teams);
    }
Run Code Online (Sandbox Code Playgroud)

鉴于:

<%: Html.DropDownListFor(model => model.teamIdHome, Model.getTeams, new { @class = "dropdownlistStyle" })%>
Run Code Online (Sandbox Code Playgroud)

jQuery:

$(function() {
$(".dropdownlistStyle").change(function () {
    $.getJSON("/Admin/GetTeams", { FooId: $(".dropdownlistStyle").val() },
       function(fooList) {
           $("#NameList").empty();
           $.each(fooList, function(i, foo) {
               $("#NameList").append(""+ foo.Name + "");
           });
       });
   });
Run Code Online (Sandbox Code Playgroud)

});

在单击“获取团队”按钮时,结果如下:

[{"Selected":false,"Text":"Arsenal","Value":"1"},{"Selected":false,"Text":"Aston Villa","Value":"3"}, {"Selected":false,"Text":"Cardiff City","Value":"20"},{"Selected":false,"Text":"Chelsea","Value":"4"},{ "Selected":false,"Text":"Crystal Palace","Value":"22"},{"Selected":false,"Text":"Everton","Value":"5"},{" Selected":false,"Text":"Fulham","Value":"6"},{"Selected":false,"Text":"Hull City","Value":"21"},{"Selected ":false,"文本":"利物浦","值":"7"},{"Selected":false,"Text":"Manchester City","Value":"8"},{"Selected":false,"Text":" Manchester United","Value":"9"},{"Selected":false,"Text":"Newcastle United","Value":"10"},{"Selected":false,"Text":" Norwich","Value":"11"},{"Selected":false,"Text":"Southampton","Value":"13"},{"Selected":false,"Text":"斯托克城","Value":"14"},{"Selected":false,"Text":"Sunderland","Value":"15"},{"Selected":false,"Text":"斯旺西城","值":"16"},{"Selected":false,"Text":"Tottenham Hotspur","Value":"17"},{"Selected":false,"Text":" West Bromwich Albion","Value":"18"},{"Selected":false,"Text":"West …

asp.net-mvc jquery json html.dropdownlistfor

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

像查询这样的sql不起作用

我正在尝试从我的数据库中检索视频名称,其中视频的主题就像我要搜索的主题.

我尝试类似的查询,但它不是返回值.

能否提出建议?

我正在使用c#与sql server.

这是我的代码.

if (con.State == ConnectionState.Open)
     con.Close();
     con.Open();
     string s1 = textBox1.Text;
     cmd = new SqlCommand("select Video_Name,subject from Videos where subject like  '%"+ s1 +" % ' " ,con);

   //cmd = new SqlCommand("select Video_Name from Videos where subject='"+ s1+"' ", con);
            SqlDataReader dr = cmd.ExecuteReader();
            ArrayList a = new ArrayList();
            label2.Visible = true;
            label3.Visible = true;

        //if (dr.Read())
        {
            while (dr.Read())
            {
                a.Add(dr[0].ToString());
            }
            foreach (string n in a)
            {
               comboBox1.Items.Add(n);
            }

            MessageBox.Show("Search succeded");
        }
Run Code Online (Sandbox Code Playgroud)

c# sql-server

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

标签<q>,<abbr>,<defn>,<ins>,<del>和<s>的正确用法是什么?

有一些我很少见到的语义标记标记.

例如,

<q>,<abbr>,<defn>,<ins>,<del>,和<s>.

是否应该使用这些标签,如果使用,在什么情况下?

html markup html5 semantics

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

使用ASP.NET Web表单将值设置为空时验证下拉列表

  <asp:DropDownList runat="server" ID="ddl">
    <asp:ListItem Text="-Select-" Value=""></asp:ListItem>
    <asp:ListItem Text="One" Value="1"></asp:ListItem>
    <asp:ListItem Text="Two" Value="2"></asp:ListItem>
    <asp:ListItem Text="Three" Value="3"></asp:ListItem>
  </asp:DropDownList>

<asp:CompareValidator ID="cvddl" runat="server" Text="Error" 
ControlToValidate="ddl" Operator="NotEqual" ValueToCompare = ""
ValidationGroup="CreateRolls"></asp:CompareValidator>
Run Code Online (Sandbox Code Playgroud)

我确实要验证下拉列表,如果select选中则应该引发错误。主要目的是该值应为空。

是否有任何方法可以像这样进行验证。请在这件事上给予我帮助

c# vb.net asp.net

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

使用SQL Server,GROUP BY

我正在研究数据库设计和架构,我遇到了一个我无法完成的问题.这里是:"列出加拿大的所有城市,然后将其人口表示为该国人口的百分比."

我的表是:

Country,CityCountryLanguage.

到目前为止,我发出的查询是:

SELECT DISTINCT City.Name,
                CAST(City.Population as float)/CAST(Country.Population as float)*100 as Percentage
FROM City,Country
Where City.CountryCode='CAN' and 
      Country.Population >0
Run Code Online (Sandbox Code Playgroud)

但是,我仍然得到多个名称和百分比超过100.我可以使用任何聚合函数来使用GROUP BY子句对名称进行分组吗?

sql sql-server

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