有沒有辦法在不導致id被更改的情況下設置元素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>
我想知道爲什麼我沒有得到那種行爲。我發現這個:http://stackoverflow.com/questions/4437717/asp-net-2-5-prefixing-ctl00-and-asp-net-4-not-prefixing-ctl00可能是,你用一個較舊的ASP.NET版本? –
我相信我們的服務器在ASP.NET 2上運行。我們最近可能安裝了3.5更新,但它不是4.0。 – steventnorris
我沒有解決方案,因爲我認爲不可能在4.0之前的任何版本中阻止該行爲,但本文至少可以提供一些見解,因爲像'ClientIDMode'這樣的東西可用> = .NET 4.0:http: //weblogs.asp.net/scottgu/archive/2010/03/30/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4- 0-series.aspx –