作者yin6705 (yin6705)
看板C_Sharp
標題Re: [問題] 怪怪的bug
時間Tue Dec 7 19:02:31 2010
※ 引述《moneylove (money)》之銘言:
: 各位版大有一個問題想請教
: 就是我這邊是一個專案
: 大約30幾個.aspx檔
: 但每一個compile後
: 都會出現同一個bug就是
: 型別 'LinkButton' 的控制項 'ctl00_ctl00_LinkButton1' 必須置於有 runat=server
: 的表單標記之中
: 請問一下為什麼會這樣
: ct100_ct100_LinkButton1是什麼??
: 如果是ID我記得我沒有這樣命名過
: 再文件中也找不到
: 請各位指教一下
: 謝謝~~~
在master page的<body>內加上<form id="form1" runat="server">
像是
<body>
<form id="form1" runat="server">
......
<asp:ContentPlaceHolder ID="ct1" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
如果再不行,就關掉visual studio,再重開試試看。
ct100_ct100_LinkButton1是ASP.NET產生目前頁面的html時,給定到html元素的id值,
你的LinkButton在aspx頁面裡的ID屬性值應該是LinkButton1,
因為有套用master page,所以前面會再加上container的id。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.120.159.50
推 moneylove:好像還是不行耶~~~ 12/08 14:16
推 moneylove:好像de出來了~~~謝謝各位 12/08 14:41
推 tomex:最好出來做個結論啦! 通常這現象都是<form>標籤位置錯了 12/10 21:49