作者a2975313 (GN)
看板C_Sharp
標題Re: [問題] ASP.NET如何偵錯?
時間Tue Aug 5 01:48:12 2008
※ 引述《a2975313 (GN)》之銘言:
: ※ 引述《a2975313 (GN)》之銘言:
: : 想請問客位
: : 我寫了一個程式,主要是使用Repeater,我分成2個檔案 一個是xxx.aspx
: : 另一個是xxx.aspx.cs
: : 想問xxx.aspx.cs檔要如何偵錯?
: xxx.aspx.cs檔裡面的程式是↓
: using System;
: using System.Collections;
: using System.Configuration;
: using System.Data;
: using System.Web;
: using System.Web.Security;
: using System.Web.UI;
: using System.Web.UI.HtmlControls;
: using System.Web.UI.WebControls;
: using System.Web.UI.WebControls.WebParts;
: public partial class _Default : System.Web.UI.Page
: {
: protected void Page_Init(object sender, EventArgs e)
: {
: rp.ItemCommand += new RepeaterCommandEventHandler(rp_ItemCommand);
: }
: void rp_ItemCommand(object source, RepeaterCommandEventArgs e)
: {
: if (e.CommandName.Equals("delCmd"))
: {
: foreach (RepeaterItem item in rp.Items)
: {
: //如果CheckBox 有勾選,進入抓取系統編號,然後刪掉此筆資料
: if (((CheckBox)item.FindControl("cb")).Checked)
: {
: int 系統編號 = Int32.Parse(((HiddenField)item.FindControl("hfd_系統編號")).Value);
: //刪除資料的動作.
: }
: }
: }
: }
: protected void Page_Load(object sender, EventArgs e)
: {
: }
: }
: 這要如何偵錯~"~
開啟專案貼上以上的程式碼後按F5,電腦顯示
「找不到型別或命名空間名稱'RepeaterCommandEventArgs'
(您是否遺漏using指示詞或組件參考?)」
因為xxx.aspx.cs檔要搭配xxx.aspx檔才能使用,cs檔裡面是Repeater的按鈕按下去後的
功能,好像不能直接偵錯上面的程式碼~"~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.229.42.65
→ KENyroj:你可能要找書來看比較快喔 = =+ 新增 web 專案 & 參考組件 08/05 08:14
→ VZA:電腦顯示 ~ 已告訴你"問題"的原因了 ~ 08/05 19:59
→ a2975313:因為那個檔案不是個完整的執行檔,這樣偵錯的時候能run嗎 08/06 02:21
→ VZA:有錯誤的程式碼,不能偵錯!要先解決問題才能偵錯! 08/06 20:41