我最近使用asp:LinkButton而不是asp:Button来表示一些CSS样式。
<asp:LinkButton ID="btnRegister" CssClass="btn btn-primary btn-lg btnSend" runat="server" OnClick="btnRegister_Click">Submit</asp:LinkButton>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
我想知道当我点击btnRegister_Click
时,我会收到错误
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.
但Button1_Click
上没有错误。
我知道禁用EnableEventValidation="false"
会遇到一些安全问题。
修改
加载和点击没有代码,我对我的设计师编码感到困惑:))
我意识到有多种形式没有runat=server
但具有method=postback
属性。我明确表示已经解决了额外的形式和问题。
为什么asp:linkbutton
这样的行为不是asp:button
?
编辑2:请不要告诉我将EnableEventValidation
更改为false,我不希望出现页面安全风险。另外,我加上
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
在web.config中并且无效。
答案 0 :(得分:0)
if you bind gridview or datalist or repeater in page load, must do it:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//all code in page_load
}
}
already You could do as the error message suggests and use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Or you could just set EnableEventValidation for the page to false.
答案 1 :(得分:-1)
选中state = {
name: {
value: ""
}
componentWillMount() {
getTokens((value) => {
if (value[0][1] === null) {
alert('whoops')
} else {
this.props.UpdateUserData(value[0][1]).then(()=>{
console.log(this.props.User.userData)
this.state.name.value = this.props.User.userData
console.log(this.state.name.value)
})
}
})
}
render() {
return (
<View style={styles.container}>
<Text style={styles.displayname}>{this.state.name.value}
</Text>
</View>
)
}