views:

66

answers:

2

What am I missing in my code to make display the calendar in my form. I get error object expected. C#

http://www.martinesexpress-inc.com/PhoneControl/MyOrders.aspx

<style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
</head>

</div>
<table class="style1" style="width:100%; color:black; background-color:orange; outline-color:Green; ">
    <tr>
        <td><b>Enter Start and End Dates</b></td>
    </tr>
</table>
<p>
    &nbsp;</p>
<table class="style1" style="width:100%; color:black; background-color:orange; outline-color:Green; ">
    <tr>
        <td>
            &nbsp;</td>
        <td><b>
            Start Date</b></td>
        <td><b>
            End Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            <asp:PlaceHolder ID="phGoBack" runat="server">Go <a class="link" href="Default.aspx">Back</a></asp:PlaceHolder>
            </b></td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>

                    <asp:TextBox ID="txtFrom" CssClass="fields" runat="server"></asp:TextBox>&nbsp;
                    <img alt src="images/cal.gif" onclick="displayDatePicker("txtFrom");" />
        </td>
        <td>
                    <asp:TextBox ID="txtTo" CssClass="fields" runat="server"></asp:TextBox>
                    <a href="javascript://"><img alt src="images/cal.gif" onclick="displayDatePicker('txtTo');"  /></a>

        </td>
        <td>
            &nbsp;</td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td>
            <asp:Literal ID="litCountRecords" runat="server"></asp:Literal>
        </td>
        <td>

            <asp:Button ID="btnRun" runat="server" onclick="btnRun_Click" Text="Run" 
                Width="37px" />
+1  A: 

Usually when you get an: [NullReferenceException: Object reference not set to an instance of an object.]

You're trying to use "something" that isn't an instance of an object/class.

Can we see some code behind?

Greg
<asp:TextBox ID="txtFrom" CssClass="fields" runat="server"></asp:TextBox> <img alt src="images/cal.gif" onclick="displayDatePicker('txtFrom');" /> </td> <td><asp:TextBox ID="txtTo" CssClass="fields" runat="server"></asp:TextBox><a href="javascript://"><img alt src="images/cal.gif" onclick="displayDatePicker(txtTo);" /></a>
Dari
here is my code. How can I pass the txt control to javascript function?
Dari
he is talking about the *.aspx.cs file
Yuriy Faktorovich
+1  A: 

to pass a control to javascript, you use (this) not ('txtTo')

but that doesn't look like your problem.... this is not a jscript error.

Russell Steen