[thelist] Weird ASP.NET problem

Asif Suria asifsuria at yahoo.com
Wed Nov 9 21:38:24 CST 2005


Hello,

I am trying to write some ASP.NET (C#) code that will
copy the information entered in certain fields
(current address) to certain other fields (permanent
address) when a checkbox is clicked. I used an example
listed on a microsoft website to build my code but
when the checkbox is clicked, nothing happens. The
page seems to have some sort of Javascript error (this
Javascript is generated by the ASP.NET page)

"error: object doesn't support this property or
method"

A stripped down version of the code is given below.
Any insights would be greatly appreciated as I have
been staring at this for over 2 hours and cant seem to
figure out what is wrong. Googling this problem brough
up posts from other folks who had the same problem but
no resolutions. 

Thanks,
Asif
http://www.sinletter.com


--------------BEGIN CODE------------------------------

<%@ Page Language="C#" Debug="true"
autoeventwireup="True" %>

<script runat="server">   
    
    void Check_Clicked(object sender, EventArgs e)
    {
        if(SameAddress.Checked)
            txtOStreet1.Text = txtCStreet1;
        else
            txtOStreet1.Text = "";
    
    }
    
    
    void Submit_Click(object sender, EventArgs e) {
    
    panelForm.Visible = false;
    
        MyHeading.Text="Thank you. Your request has
been submitted.";
        MyHeading.Visible = true;
    }

</script>
<html>
<head>
    <title>Some Form</title>
    <link href="../../images/interface/PageFeel.css"
type="text/css" rel="stylesheet" />
</head>
<body>
    <form id="someForm" runat="server">
        <center><asp:Label id="MyHeading"
runat="server"></asp:Label>
        </center>
        <asp:Panel id="panelForm" Visible="True"
Runat="Server">
            <div align="center">
                
                <table class="tablefont"
cellspacing="2" cellpadding="2" width="650"
border="0">
                    <tbody>
                        <tr>
                            <td align="right"
width="400">
                                <b>Current Mailing
Address</b> 
                            </td>
                            <td align="right"
width="250">
                                &nbsp; 
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="tablefont"
cellspacing="2" cellpadding="2" width="650"
border="1">
                    <tbody>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Street
1</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCStreet1" Runat="Server" MaxLength="75"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Street
2*</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCStreet2" Runat="Server" MaxLength="75"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">City</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCCity" Runat="Server" MaxLength="30"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">State</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCState" Runat="Server" MaxLength="25"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">Zip</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCZip" Runat="Server" MaxLength="50"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Valid
Until</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtCValid" Runat="Server" MaxLength="15"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <br />
                <table class="tablefont"
cellspacing="2" cellpadding="2" width="650"
border="0">
                    <tbody>
                        <tr>
                            <td align="right"
width="400">
                                <b>Permanent
Address</b> 
                            </td>
                            <td align="right"
width="250">
                                <asp:CheckBox
id="SameAddress" Runat="Server" Text=" Check if same
as above" AutoPostBack="True"
OnCheckedChanged="Check_Clicked"></asp:CheckBox>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <table class="tablefont"
cellspacing="2" cellpadding="2" width="650"
border="1">
                    <tbody>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Street
1</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOStreet1" Runat="Server" MaxLength="75"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Street
2*</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOStreet2" Runat="Server" MaxLength="75"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">City</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOCity" Runat="Server" MaxLength="30"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">State</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOState" Runat="Server" MaxLength="25"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td valign="bottom"
width="150" height="25">
                                <font
size="2">Zip</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOZip" Runat="Server" MaxLength="50"
Columns="20"></asp:TextBox>
                            </td>
                            <td valign="bottom"
width="150" height="25">
                                <font size="2">Valid
Until</font></td>
                            <td width="200"
height="25">
                                <asp:TextBox
id="txtOValid" Runat="Server" MaxLength="15"
Columns="20"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <br />
                <br />
                <asp:Button id="submit"
onclick="Submit_Click" runat="server"
Text="Submit"></asp:Button>
            </div>
        </asp:Panel>
    </form>
</body>
</html>

--------------END CODE------------------------------



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs



More information about the thelist mailing list