مرجع تخصصی برنامه نویسان

انجمن تخصصی برنامه نویسان فارسی زبان

کاربر سایت

apameh

عضویت از 1395/01/21

خطا برای Button

  • پنجشنبه 28 مرداد 1395
  • 10:11
تشکر میکنم
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1061: 'ASP.edit_user_aspx' does not contain a definition for 'Button2_Click' and no extension method 'Button2_Click' accepting a first argument of type 'ASP.edit_user_aspx' could be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 35:         <tr>
Line 36:             <td colspan="2" dir="rtl">
Line 37:                 <asp:Button ID="Button2" runat="server" BackColor="#CC33FF" Font-Bold="True" Font-Names="B Yekan" Height="41px" OnClick="Button2_Click" Text="ثبت ویرایش" Width="156px" />
Line 38:                 <asp:Label ID="Label1" runat="server" Text="ویرایش شد." Visible="False" ForeColor="#FF0066"></asp:Label>
Line 39:             </td>

 

درود بر شما

من صفحه ویرایش کاربر دارم که اطلاعات ویرایش میشه ودر آخر روی دکمه ثبت زده میشه ، من این کد رو از پروژه دیگه ام Copy و در اینجا Past کردم و در پروژه قبیلم درست جواب میداد اما در اینجا این خطا رو میده.

لطفا رهنمایی کنید.

سپاس

پاسخ های این پرسش

تعداد پاسخ ها : 3 پاسخ
کاربر سایت

ایمان مدائنی

عضویت از 1392/01/20

  • پنجشنبه 28 مرداد 1395
  • 11:14

روی Button2 دوبار کلیک کنید تا رویداد ساخته بشه و بعد مشکل برطرف میشه

کاربر سایت

apameh

عضویت از 1395/01/21

  • پنجشنبه 28 مرداد 1395
  • 11:28

الان این خطا رو میده:

Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 15:         if (!IsPostBack) //avalin bari ke dar safhe gharar migiry in etefagh biofte
Line 16:         {
Line 17:             int UserId = int.Parse(Request.QueryString["UserId"].ToString());//az q.s ke dar page ghabl pas dade shode estefade konim
Line 18:             string con = "Data Source=.;Initial Catalog=Web Programming;Integrated Security=True";
Line 19:             SqlConnection connect = new SqlConnection(con);

 

کاربر سایت

apameh

عضویت از 1395/01/21

  • شنبه 30 مرداد 1395
  • 17:33

UserId را دوباره ارتبا دادم و مشکلم حل شد.

کاربرانی که از این پست تشکر کرده اند

هیچ کاربری تا کنون از این پست تشکر نکرده است

اگر نیاز به یک مشاور در زمینه طراحی سایت ، برنامه نویسی و بازاریابی الکترونیکی دارید

با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)