从GridView中单击链接按钮时,获取无效的回发或回调参数错误 [英] Getting Invalid postback or callback argument error when linkbutton is clicked from gridview

查看:101
本文介绍了从GridView中单击链接按钮时,获取无效的回发或回调参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我单击gridview中的链接时,出现以下错误.请任何人都可以帮助我.

Hi,

When I click on the link in the gridview,I am getting this below error. please anybody can help me.

Invalid postback or callback argument.  Event validation is enabled using <pages enableeventvalidation="true" /> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation


和我的页面是这样的


and my page goes like this

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PatientMapByFacility.aspx.cs" EnableEventValidation="false"

    MasterPageFile="~/Master_Pages/PhysicianMaster.Master" Inherits="CarePortalOnline.CareHIEUI.PatientMapByFacility" %>



当我设置



When I set

EnableEventValidation="false"

事件未触发.

OnClick="lnkView_Click" event is not firing.

推荐答案

Dim btn As LinkButton = CType(sender, LinkButton)
       Dim g As GridViewRow = CType(btn.NamingContainer, GridViewRow)
       Dim rowindex As Int16 = g.RowIndex
       Dim hid As HiddenField
       hid = gvPatient.Rows(rowindex).Cells(0).FindControl("hidid")

       Dim lnkbtn As LinkButton
       lnkbtn = gvPatient.Rows(rowindex).Cells(3).FindControl("LinkButton1")
              
       GetAllPatientList()




尝试在gridview中使用linkbutton的此onclick事件.我已经使用了此代码,并且工作正常.在C#中对其进行更改并使用.




try using this...onclick event of linkbutton in a gridview..I had already used this code and working fine..Change it in C# and use.


设置
<customerrors mode="Off" />

文件


1)首先检查是否在要存储在数据库中的文本框中写了一些HTML标记.

Sol:设置EnableEventValidation="False"或将其放置在页面指令上或将其放置在web.config文件中

2)检查是否要将数据绑定到Gridview,dropdownlist或任何服务器控件,应将绑定的代码放在Page_Load
1) First Check whether you write some HTML tags inside the Textbox that you are going to store it on DB.

Sol: set the EnableEventValidation="False" either place this on page Directive or put this on web.config file

2) Check whether you are going to bind the data to Gridview , dropdownlist or any server control you should place the binded code within the IsPostBack -- property on Page_Load


这篇关于从GridView中单击链接按钮时,获取无效的回发或回调参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆