Hi there,
I have two textboxes and a Button in my aspx page..I have dynamically create a radcaptcha with enablerefreshimage=true in Onint event...I have to do some stuff in my button click..After clicking "Get New Image" link,unknown error occured after I clicked my Button..But everything was fine without clicking "Get new Image"..Here is the error,,
Invalid postback or callback argument. Event validation is enabled using 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
Here is my code,,
Backend Code::
What mistake I have done in the above code...
Thanks,
S.Suresh
I have two textboxes and a Button in my aspx page..I have dynamically create a radcaptcha with enablerefreshimage=true in Onint event...I have to do some stuff in my button click..After clicking "Get New Image" link,unknown error occured after I clicked my Button..But everything was fine without clicking "Get new Image"..Here is the error,,
Invalid postback or callback argument. Event validation is enabled using 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
Here is my code,,
<
table
>
<
tr
>
<
td
><
asp:TextBox
ID
=
"tb1"
Width
=
"300"
runat
=
"server"
></
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:TextBox
ID
=
"tb2"
Width
=
"300"
runat
=
"server"
></
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
> <
asp:Panel
ID
=
"pnlCaptcha"
runat
=
"server"
>
</
asp:Panel
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"center"
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Type the above code in text box"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"center"
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
></
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
asp:Button
ID
=
"btnEnroll"
runat
=
"server"
ValidationGroup
=
"vgAudio"
Text
=
"Enroll"
OnClientClick
=
"this.disabled=true"
Visible
=
"false"
OnClick
=
"btnEnroll_Click"
UseSubmitBehavior
=
"false"
/><
br
/>
</
td
>
</
tr
>
</
table
>
Backend Code::
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
RadCaptcha radCaptch = new RadCaptcha();
radCaptch.ID = "RadCaptcha1";
radCaptch.ValidationGroup = "vgAudio";
radCaptch.ValidatedTextBoxID = TextBox1.ID;
radCaptch.EnableRefreshImage = true;
radCaptch.CaptchaImage.RenderImageOnly = true;
radCaptch.ForeColor = Color.Red;
radCaptch.Attributes.Add("meta:resourcekey", "radCaptchaResource1");
radCaptch.ErrorMessage = "Please type the valid code";
//Add the captcha to panel
pnlCaptcha.Controls.Add(radCaptch);
}
protected void btnEnroll_Click(object sender, EventArgs e)
{
//Do some stuff
}
Thanks,
S.Suresh