Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.net中单击特定文章的链接时显示其详细信息_C#_Asp.net_Ajax - Fatal编程技术网

C# 在ASP.net中单击特定文章的链接时显示其详细信息

C# 在ASP.net中单击特定文章的链接时显示其详细信息,c#,asp.net,ajax,C#,Asp.net,Ajax,我有以下代码,它将文章标题显示为列表中的超链接。。点击这个链接,它应该会显示存储在ArrayList al中的帖子的其他详细信息。请帮我怎么做 protected void Page_Load(object sender, EventArgs e) { DB ob = new DB(); string html = ""; ArrayList temp = new ArrayList(); DB.open(); ArrayList al = new A

我有以下代码,它将文章标题显示为列表中的超链接。。点击这个链接,它应该会显示存储在ArrayList al中的帖子的其他详细信息。请帮我怎么做

  protected void Page_Load(object sender, EventArgs e)
{
    DB ob = new DB();
    string html = "";
    ArrayList temp = new ArrayList();
    DB.open();
    ArrayList al = new ArrayList();
    for (int i = 1; i <= 4; i++)
    {
        al.Add(ob.fetch_post(i));
        temp = (ArrayList)al[i-1];

        html = html + "<div class=\"spacer\"></div>" + " " + "<div id=\"Title\" +i+"\" class=\"title\">"+ "<a href=\"#\"/>" + temp[0] + "</a> </div>";
    }
    wrapper_title.InnerHtml = html;      
}

现在我面临的问题是,动态地从Title1到Title4创建divid时,我不知道如何调用上面的AJAX函数。还可以帮助我将ArrayList al作为参数从Ajax传递给显示C#…

Change#Title to的函数。Title@RameshRajendran:谢谢你,这很有效。现在,如何将ArrayList al作为参数从ajax传递到C#函数?请参考并尝试以下链接方式:
   $(document).ready(function () {
// Add the page method call as an onclick handler for the div.
$("#Title").click(function () {
    $.ajax({
        type: "POST",
        url: "Default.aspx/display",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            // Replace the div's content with the page method's return.
            $("#sidebar1").text(msg.d);
        }
    });
   });
  });