2017-07-05 13 views
0

ASP.NETでLINQ to SQLを使用してデータを挿入したいとします。私のコードは以下の通りです。しかし、 'Kaydet'ボタンをクリックすると、エラーが発生しました。どうすれば修正できますか?ASP.NETでLINQ to SQLを使用して挿入 - エラー

protected void btnKaydet_Click(object sender, EventArgs e) 
    {  
      DBDataContext dbnew = new DBDataContext(); 
      tbl_Kullanicilar user = new tbl_Kullanicilar(); 

      user.Kullanici_adi = txtKullaniciAdi.Text; 
      user.Profil_isim = txtİsim.Text; 
      user.Mail = txtEmail.Text; 
      user.Kullanici_soyisim = txtSoyisim.Text; 
      user.Kullanici_Sifre = txtSifre.Text; 
      user.Durum = drpDurum.Text; 
      user.Tur = drpTür.Text; 
      user.Telefon = txtTelefon.Text; 

     dbnew.tbl_Kullanicilars.InsertOnSubmit(user); 
     dbnew.SubmitChanges();    
    } 

the error

enter image description here

Error with English : Invalid postback or recall independent variable. Event validation was enabled using or <% @ Page EnableEventValidation = "true"%> in the configuration. This feature verifies that, for security reasons, the return or recall events arguments result from the server control handling them at startup. If the data is valid and as expected, use the ClientScriptManager.RegisterForEventValidation method to save the return or recall data for validation. Explanation: An unhandled exception occurred while executing the current web request. Please observe the stack trace to find out more about the error and where it originates in the code. Exception Details: System.ArgumentException: Invalid postback or recall independent variable. Event validation was enabled using or <% @ Page EnableEventValidation = "true"%> in the configuration. This feature verifies that, for security reasons, the return or recall events arguments result from the server control handling them at startup. If the data is valid and as expected, use the ClientScriptManager.RegisterForEventValidation method to save the return or recall data for validation. Source Error: An exception was thrown when the current web request was executed. Information about the source and location of the exception can be determined using the following exception stack trace.

+0

がないよう、テキストとしてのコードを投稿してくださいする必要があります画像。また、エラーメッセージを英語に翻訳すると非常に役に立ちます。 –

+0

投稿が更新されます。 –

+0

提出されているフォームに入力されたデータのリクエストの検証に失敗したために発生したエラーです。フォームに入力したデータを教えてください。無効なデータには、いくつかのHTMLコンテンツやスクリプトがあります。 –

答えて

0

私はこのエラーを解決し、私が役に立つ他の人であることに解決策を共有したいです。解決策はそれです。

このエラーが発生した場合、この属性は、結果としてexample.aspx

enableEventValidation="false" 

の開始追加する必要があり、それは

<%@ Page Title="" enableEventValidation="false" Language="C#" MasterPageFile="~/ProjectMenagement.Master" AutoEventWireup="true" CodeBehind="Kişiler_kişiekle.aspx.cs" Inherits="WebApplication1.Kişiler_kişiekle" %> 
+0

これは本当に問題を解決するのではなく、無視しています。 – Pleun

+0

私はあなたに同意しますが、プロジェクトに属性を追加すると、問題は解決されます。 –

関連する問題