在不更改ID的情况下运行服务器

时间:2013-09-25 12:52:42

标签: c# html .net html-table identity

有没有办法设置元素runat="server"而不会导致id被更改?

我有一个母版页和一个内容页面。在此内容页面中是一个ID为id="fulllist_list_table"的表。如果我将runat="server"应用于tbl元素,则ID将变为id="ctl00_content_fulllist_list_table。我宁愿改变也不会发生。

有没有办法让上面的场景不改变表元素的id?

代码如下。

内容HTML

<%@ Page Language="C#" MasterPageFile="master.master" Inherits="DenApp.fulllist" Title="DenApp - Full List"%>
<asp:content ID="contentInternal" contentplaceholderid="content" runat="server">
<script type="text/javascript">
    $(document).ready(function () {
        $("#master_tabs_div_fulllist").removeClass("master_tabs_links");
        $("#master_tabs_div_fulllist_div").removeClass("master_tabs_tabs");
        $("#master_tabs_div_fulllist_div").addClass("master_tabs_selected");
        $("#fulllist_list_table").tablesorter({
            widgets: ["zebra", "filter"],
            widgetOptions: {
                filter_childRows: false,
                filter_columnFilter: true,
                filter_ignoreCase: true,
                filter_liveSearch: true,
                filter_searchDelay: 100,
                filter_startsWith: true,
            }
        });
        $("#fulllist_list_table").tablesorterPager({
            container: $("#fulllist_paging_div"),
            size: 25,
            output: '{startRow}-{endRow}/{totalRows}',
            cssNext: '#fulllist_paging_div_nextbtn',
            cssPrev: '#fulllist_paging_div_prevbtn',
            cssFirst: '#fulllist_paging_div_firstbtn',
            cssLast: '#fulllist_paging_div_lastbtn',
            cssPageSize: '#fulllist_paging_div_pagesize',
        });


});
</script>
<link rel="Stylesheet" href="./css/fulllist.css" />
    <div id="master_content_wrapper">
        <div id="fulllist_list_div">
            <table id="fulllist_list_table" class="tablesorter" runat="server" clientidmode="Static">
                <thead>
                    <tr>
                        <th>Account Number</th>
                        <th>Patient Name</th>
                        <th>Plan Code</th>
                        <th>Carrier</th>
                        <th>Billed Patient Type</th>
                        <th>Initial Patient Type</th>
                        <th>Denial Code</th>
                        <th>Denial Reason</th>
                        <th>Admit Date</th>
                        <th>Discharge Date</th>
                        <th>Appeal Amount</th>
                        <th>Total Charges</th>
                        <th>Received Date</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>C0000000000</td>
                        <td>Smith, John T</td>
                        <td>000000</td>
                        <td>Insurance</td>
                        <td>PT</td>
                        <td>PT</td>
                        <td>0000</td>
                        <td>Denied</td>
                        <td>01/01/01</td>
                        <td>01/01/01</td>
                        <td>$100.00</td>
                        <td>$100.00</td>
                        <td>01/04/01</td>
                    </tr>
                    <tr>
                        <td>C0000000001</td>
                        <td>Rita, John T</td>
                        <td>000001</td>
                        <td>Insurance</td>
                        <td>PT</td>
                        <td>PT</td>
                        <td>0000</td>
                        <td>Denied</td>
                        <td>02/01/01</td>
                        <td>01/02/01</td>
                        <td>$200.00</td>
                        <td>$1,000,000.00</td>
                        <td>01/04/01</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="fulllist_paging_div">
            <div id="fulllist_paging_div_firstbtn" class="fulllist_tablenav">
            </div>
            <div id="fulllist_paging_div_prevbtn" class="fulllist_tablenav">
            </div>
            <div id="fulllist_paging_div_numpages_div" >
                <select id="fulllist_paging_div_pagesize">
                    <option value="10">10</option>
                    <option selected="selected" value="25">25</option>
                    <option value="50">50</option>
                    <option value="100">100</option>
                    <option value="150">150</option>
                    <option value="200">200</option>
                </select>
            </div>
            <div id="fulllist_paging_div_pagedisplay" class="pagedisplay">
            </div>
            <div id="fulllist_paging_div_nextbtn" class="fulllist_tablenav">
            </div>
            <div id="fulllist_paging_div_lastbtn" class="fulllist_tablenav">
            </div>
        </div>
    </div>
</asp:content>

1 个答案:

答案 0 :(得分:1)

ClientIDMode 设置为Static到表格元素。

<table id="fulllist_list_table" runat="server" clientidmode="Static">

正如您在评论中提到的那样,您使用的是.Net 2.0框架,所以我想告诉您,遗憾的是ClientIDModeframework 4.0之前无法使用Auto。 看here for this change

旧版本的值为{{1}}。