Checkbox viewstate

D

Davix

Hi,

Maybe I'm crazy but...

I'm going to try to explain this ¿"bug"?

I've 2 aspx pages.

In page 1:

1 checkbox with default properties

1 textbox with autopostback=true

1 button

Page 2 is a blank page.

First I've checked the checkbox control and then I've click the
button.

Page 2 is open and then I close this second page.

Then when Page 1 appears again checkbox checked property value is
false!!!

How it's possible??

If I set autopostback property of textbox control to false, everything
works fine!!!

Thanks in advance.

Page 1 aspx
code-----------------------------------------------------------------------

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="_test.aspx.vb" Inherits="_test" Debug="false"
Explicit="true" Strict="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
said:
<asp:TextBox ID="TextBox1" runat="server"
AutoPostBack="True"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />

</div>
</form>
</body>
</html>
Page 1 codebehind--------------------------------------------------

Partial Class _test
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strscript As String
strscript =
"<script>window.showModalDialog('_nothing.aspx','','dialogWidth:
460px;dialogHeight:350px'); __doPostBack('','');</script>"
ClientScript.RegisterClientScriptBlock(GetType(_test),
"s_window", strscript, False)
End Sub
End Class


Page 2 aspx
code------------------------------------------------------------

<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="_nothing.aspx.vb" Inherits="_nothing" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
 
G

Guest

Try using ClientScript.RegisterStartupScript () instead of
ClientScript.RegisterClientScriptBlock().
 
D

Davix

Try using ClientScript.RegisterStartupScript () instead of
ClientScript.RegisterClientScriptBlock().































- Mostrar texto de la cita -

Thank you very much, it works.
You are my salvation.
Thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top