나는 내 사이트에 대한 captcha를 제작하고 있으며, 공상적이고 개인적인 용도로는 사용하지 않습니다. 내 문제는 새로 고침 단추를 눌러 captcha 상자에 새 이미지를 가져 오는 경우 captcha 텍스트 상자도 다시 설정해야한다는 것입니다. 내가 그것을 텍스트 상자에 입력 된 값을 보여줍니다 디버거를 실행하면버튼 새로 고침 텍스트가 삭제되지 않음
내가 그렇게
protected void btnRefresh_Click(object sender, EventArgs e)
{
//This is the call that creates a new image
FillCaptcha();
// to clear the text box
txtCaptcha.Text = String.Empty;
}
처럼 설정하고 이후시의 설정 ""로 설정합니다.
다음은 버튼 및 텍스트 상자 레이아웃 몇 시간 동안 스택
<asp:TableRow>
<asp:TableCell>
Enter Below Captcha Code :
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="txtCaptcha" runat="server" Width="200px"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
</asp:TableCell>
<asp:TableCell VerticalAlign="middle">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UP1" runat="server">
<ContentTemplate>
<table>
<tr>
<td style="height: 50px; width:120px; border:solid; border-color:blue; text-align:center;">
<asp:Image ID="imgCaptcha" runat="server" />
</td>
<td valign="middle">
<asp:Button ID="btnRefresh" runat="server" Text="Refresh" OnClick="btnRefresh_Click" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:TableCell>
</asp:TableRow> `
필자 검색을하고 모든 사람이 내가 그것을 가지고로 설정 될 것으로 보인다. 다른 함수에서 txtCaptcha.Text = String.Empty;
에 대한 동일한 호출이 있으며 정상적으로 작동합니다. 어떤 도움이라도 감사 할 것입니다. 뭔가에 대해 잘 모르는 경우 알려주고 아프게 설명하는 것이 최선입니다.
는'txtCaptcha.Text'는 UpdatePanel 밖에 읽어보십시오. 안쪽으로 움직여. – VDWWD
'txtCaptcha.Text = String.Empty;'라인이 맞았습니까? –
@VDWWD 지금 시도해보십시오. – poohbear