当我通过我的母版页中的转发器中的response.redirect发送数据时出现问题 [英] problem when i sending data through response.redirect in repeater in my masterpage

查看:82
本文介绍了当我通过我的母版页中的转发器中的response.redirect发送数据时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有的朋友..

我有问题我在主页的中继器中获取一些数据..并代表点击中继器内的按钮

我在其他页面上发送一些数据以查看一些细节...



我的错误是详细信息是.....



无效的回发或回调参数。使用< pages enableEventValidation =true/>启用事件验证在配置或<%@ Page EnableEventValidation =true%>在一个页面中。出于安全考虑,此功能可验证回发或回调事件的参数是否来自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.ArgumentException:无效的回发或回调参数。使用< pages enableEventValidation =true/>启用事件验证在配置或<%@ Page EnableEventValidation =true%>在一个页面中。出于安全考虑,此功能可验证回发或回调事件的参数是否来自最初呈现它们的服务器控件。如果数据有效且符合预期,请使用ClientScriptManager.RegisterForEventValidation方法注册回发或回调数据以进行验证。






结束我的转发器设计代码是......

< asp:Repeater ID =Repeater1runat =server

onitemcommand =Repeater1_ItemCommand>

< ItemTemplate>

< asp:Label ID =Label3runat =serverText =Request from >< / asp:Label>< asp:Button ID =Button1runat =serverText =''<%#Eval(Name)%>''OnClick =Button1ClickBorderStyle = 无BackColor =#FF2F2F/>< asp:Label ID =Label2Visible =falserunat =serverText =''<%#Eval(Request_id)%>' >< / ASP:标签> < br />

< / ItemTemplate>

< / asp:Repeater>


和cs代码单击按钮是..



protected void Button1Click(object sender,EventArgs e)

{



按钮btn =(按钮)发件人;

RepeaterItem item =(RepeaterItem)btn.NamingContainer;

int indexx = item .ItemIndex;

Label lbl =(Label)Repeater1.Items [indexx] .FindControl(Label2);

string Valuelbl = lbl.Text;

Response.Redirect(requestDetail.aspx?a =+ Server.UrlEncode(Valuelbl));

}


我无法理解这个问题......给出了建议的问题,我能做些什么...?

Hi to all frnds..
I have a problem i am getting some data in repeaters of my master page..and on behalf click of button inside repeater
I sending some data on other page for seeing some detail...

My error is detail is.....
"
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.
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.ArgumentException: 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.

"

End my repeater design code is ...
<asp:Repeater ID="Repeater1" runat="server"
onitemcommand="Repeater1_ItemCommand">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text="Request from"></asp:Label><asp:Button ID="Button1" runat="server" Text=''<%#Eval("Name") %>'' OnClick="Button1Click" BorderStyle="None" BackColor="#FF2F2F" /><asp:Label ID="Label2" Visible="false" runat="server" Text=''<%#Eval("Request_id") %>''></asp:Label> <br />
</ItemTemplate>
</asp:Repeater>

And cs code of button click is..

protected void Button1Click(object sender, EventArgs e)
{

Button btn = (Button)sender;
RepeaterItem item = (RepeaterItem)btn.NamingContainer;
int indexx = item.ItemIndex;
Label lbl=(Label)Repeater1.Items[indexx].FindControl("Label2");
string Valuelbl=lbl.Text;
Response.Redirect("requestDetail.aspx?a=" +Server.UrlEncode(Valuelbl));
}

I m unable to understand the problem...give suggetion frnds, what can i do in this...?

推荐答案

在你的顶部的页面指令page add EnableEventValidation =false

At the page directive at the top of your page add EnableEventValidation="false"
<%@ Page EnableEventValidation="false" %>


在这里,看一下这篇博文:无效的回发或回调参数 [ ^ ]
Here, have a look at this blog post: "Invalid postback or callback argument"[^]


这篇关于当我通过我的母版页中的转发器中的response.redirect发送数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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