using AjaxControlToolkit;    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton[] Lin = new LinkButton[10];
            ModalPopupExtender[] Mo = new ModalPopupExtender[10]; //这句有问题            int i = 0;
            foreach (GridViewRow row in GridView1.Rows)
            {
                Lin[i] = row.FindControl("LinkButton1") as LinkButton;
                Mo[i].TargetControlID = "GridView1$ctl10$LinkButton1";
                Mo[i].PopupControlID = "PPanel1";
                Mo[i].BackgroundCssClass = "modalBackground";
                Mo[i].OkControlID = "OkButton";
                Mo[i].PopupDragHandleControlID = "PPanel3";
                i++;
            } 
        } 
    }怎样用代码 创建AjaxControlToolkit.ModalPopupExtender

解决方案 »

  1.   

    using AjaxControlToolkit;     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
        { 
            if (e.Row.RowType == DataControlRowType.DataRow) 
            { 
                LinkButton[] Lin = new LinkButton[10]; 
                ModalPopupExtender[] Mo = new ModalPopupExtender[10]; //这句有问题            
                  int i = 0; 
                foreach (GridViewRow row in GridView1.Rows) 
                { 
                    Lin[i] = row.FindControl("LinkButton1") as LinkButton; 
                    Mo[i].TargetControlID = Lin[i].UniqueID.ToString(); 
                    Mo[i].PopupControlID = "PPanel1"; 
                    Mo[i].BackgroundCssClass = "modalBackground"; 
                    Mo[i].OkControlID = "OkButton"; 
                    Mo[i].PopupDragHandleControlID = "PPanel3"; 
                    i++; 
                } 
            } 
        } 
      

  2.   

    画面上是否放置了ScriptManager控件
      

  3.   

    在vs 2005 中安装ajax 的控件
    直接拖放相映的容器和控件 
    在容器里面再放普通的控件和处理事件等
      

  4.   

    怎么不用updatepanel的更新控件!
      

  5.   

    不行的 我运行后查看源代码 ajax的TargetControlID取的是name 不是取的id 我想用js写下 看有人能帮忙么??
      

  6.   

    js的话可以写的出来,但是如果要把ajaxcontroltookit和js一起用,,仿佛有些不妥,,
      

  7.   

    在AJAX里面如果要想使用其它控件的ID使用ClientID,如果是在客户端用$get后加控件的ID就可以了。