Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.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# html表格在ajaxToolkit:TabPanel中时会消失_C#_Jquery_Html - Fatal编程技术网

C# html表格在ajaxToolkit:TabPanel中时会消失

C# html表格在ajaxToolkit:TabPanel中时会消失,c#,jquery,html,C#,Jquery,Html,我使用tablesorter插件对HTML表进行排序。 当我将表放在ajaxToolkit选项卡面板中时,HTML表的标题就会消失。(当HTML表格在ajaxToolkit选项卡面板之外时,就可以了。) $(窗口).load(函数(){ $(“#connectedactivitistable”).append(“profix prog loc pop div”); $(“#ConnectedActivityTable”).tablesorter(); }); "; 行.控件.添加(单元格); c

我使用tablesorter插件对HTML表进行排序。 当我将表放在ajaxToolkit选项卡面板中时,HTML表的标题就会消失。(当HTML表格在ajaxToolkit选项卡面板之外时,就可以了。)

$(窗口).load(函数(){
$(“#connectedactivitistable”).append(“profix prog loc pop div”);
$(“#ConnectedActivityTable”).tablesorter();
});
";
行.控件.添加(单元格);
cell=新的HtmlTableCell();
cell.InnerText=activity.LocationDesc;
行.控件.添加(单元格);
cell=新的HtmlTableCell();
cell.InnerText=activity.PopulationDesc;
行.控件.添加(单元格);
cell=新的HtmlTableCell();
cell.InnerText=activity.DivisionDesc;
行.控件.添加(单元格);
htmlTable.Controls.Add(行);
} 
}
谢谢,我找到了答案

将HTML表放入ajaxToolkit:TabPanel时,Ajax会更改HTML表的ID(在源代码中可见)。因此,HTML表必须通过新ID或使用类进行引用

<table id="ConnectedActivitiesTable" runat="server"  class="ConnectedActivitiesTableCss">

<script type="text/javascript">
 $(window).load(function () { 
            $('.ConnectedActivitiesTableCss').append("<thead> <tr> <th> profix </th> <th> prg </th> <th> loc</th> <th> pop</th> <th> div</th> </tr> </thead>");            
       });
</script>

$(窗口).load(函数(){
$('.ConnectedActivityTableCSS')。追加(“profix prg loc pop div”);
});
我更改了iD说明符
$(“#ConnectedActivitisTable”)
到类说明符
$('.ConnectedActivityTableCSS')

                </table>
            </ContentTemplate>
        </ajaxToolkit:TabPanel>

        <ajaxToolkit:TabPanel ID="RelatedPrograms" HeaderText="connected" runat="server">
            <ContentTemplate>
                   <table id="ConnectedActivitiesTable" runat="server" class=tbl > </table>
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
    public static void ShowTable(List<ActivityAllDetails> activityList, HtmlTable htmlTable)
    {
        htmlTable.Visible = true;
        HtmlTableCell cell;
        HtmlTableRow row;

        foreach (var activity in activityList)
        {
            cell = new HtmlTableCell();
            cell.Attributes.Add("dir", "ltr");
            cell.InnerText = activity.ProphixNo;
            row = new HtmlTableRow();
            row.Controls.Add(cell);

            cell = new HtmlTableCell();

            cell.InnerHtml = "<a href=Tabs.aspx?" + QryStringKeys.ACTIVITY_ID + "=" + activity.ActivityId + ">" + (activity.Prg2NameHeb != null ? activity.Prg2NameHeb : activity.Prg2Name) + " </a>";
            row.Controls.Add(cell);

            cell = new HtmlTableCell();
            cell.InnerText = activity.LocationDesc;
            row.Controls.Add(cell);


            cell = new HtmlTableCell();
            cell.InnerText = activity.PopulationDesc;
            row.Controls.Add(cell);

            cell = new HtmlTableCell();
            cell.InnerText = activity.DivisionDesc;
            row.Controls.Add(cell);


            htmlTable.Controls.Add(row);
        } 

    }
<table id="ConnectedActivitiesTable" runat="server"  class="ConnectedActivitiesTableCss">

<script type="text/javascript">
 $(window).load(function () { 
            $('.ConnectedActivitiesTableCss').append("<thead> <tr> <th> profix </th> <th> prg </th> <th> loc</th> <th> pop</th> <th> div</th> </tr> </thead>");            
       });
</script>