Home All Groups Group Topic Archive Search About

Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of 'ASP.WebForm1_aspx'

Author
4 Oct 2006 6:24 PM
Tony Girgenti
Hello.

I'm developing and testing a web application using VS.NET 2003, VB, .NET
Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
computer.  I'm using a web form.

I'm trying create a function in javascript to compare dates between calendar
selected dates(that's not really my problem yet).

I can't get the html to recognize the function that i have created.  When i
run the program, it gives the error
Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
'ASP.WebForm1_aspx'
Source Error:


Line 77:                 Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT: 16px;
POSITION: absolute; TOP: 16px" runat="server"
Line 78:                 Height="72px"
ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
Line 79:             <asp:button id="btnGetArchivedTrips" onclick="btnGAT_onClick();"
style="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 152px"
Line 80:                 accessKey="G" runat="server" Width="128px" BorderStyle="Solid"
ForeColor="OrangeRed" BackColor="White"
Line 81:                 Text="Get Archived Trips"></asp:button>


Here is my html:
  <script id=clientEventHandlersJS language=javascript>
<!--
function document_onclick() {
}

//-->
</script>
<script language=javascript for=document event=onclick>
<!--
function btnGAT_onClick() {
var startDate = calendar1.selected.date
var endDate = calendar2.selected.date
}
return document_onclick()
//-->
</script>

I have this line in the Page_load event:

Me.btnGetArchivedTrips.Attributes.Add("onclick", "return btnGAT_onClick()")

Why is it not finding that function ?

Any help would be gratefully appreciated.

Thanks,
Tony

Author
4 Oct 2006 8:21 PM
Ken Cox [Microsoft MVP]
Hey Tony,

You're mixing server-side clicks and client-side scripts inappropriately.

Try taking this out of your server-side code:

onclick="btnGAT_onClick();"

It looks like you might be doing the same with the calendar too.

Ken


Show quoteHide quote
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
> Hello.
>
> I'm developing and testing a web application using VS.NET 2003, VB, .NET
> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
> computer.  I'm using a web form.
>
> I'm trying create a function in javascript to compare dates between
> calendar selected dates(that's not really my problem yet).
>
> I can't get the html to recognize the function that i have created.  When
> i run the program, it gives the error
> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
> 'ASP.WebForm1_aspx'
> Source Error:
>
>
> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
> 16px; POSITION: absolute; TOP: 16px" runat="server"
> Line 78: Height="72px"
> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
> Line 79: <asp:button id="btnGetArchivedTrips" onclick="btnGAT_onClick();"
> style="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 152px"
> Line 80: accessKey="G" runat="server" Width="128px" BorderStyle="Solid"
> ForeColor="OrangeRed" BackColor="White"
> Line 81: Text="Get Archived Trips"></asp:button>
>
>
> Here is my html:
>  <script id=clientEventHandlersJS language=javascript>
> <!--
> function document_onclick() {
> }
>
> //-->
> </script>
> <script language=javascript for=document event=onclick>
> <!--
> function btnGAT_onClick() {
> var startDate = calendar1.selected.date
> var endDate = calendar2.selected.date
> }
> return document_onclick()
> //-->
> </script>
>
> I have this line in the Page_load event:
>
> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
> btnGAT_onClick()")
>
> Why is it not finding that function ?
>
> Any help would be gratefully appreciated.
>
> Thanks,
> Tony
>
>
Author
4 Oct 2006 9:15 PM
Tony Girgenti
Hello Ken.

That succeeded in eliminating the error, but it doesn't seem to be executing
my function.
}
function btnGAT_onClick() {
var startDate = calendar1.selecteddate
var endDate = calendar2.selecteddate
if startDate > endDate
alert('Incorrect dates')
end if
}

Is there a way to stop it in the debugger to see what's going on ?

Thanks,
Tony

Show quoteHide quote
"Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in message
news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
> Hey Tony,
>
> You're mixing server-side clicks and client-side scripts inappropriately.
>
> Try taking this out of your server-side code:
>
> onclick="btnGAT_onClick();"
>
> It looks like you might be doing the same with the calendar too.
>
> Ken
>
>
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>> Hello.
>>
>> I'm developing and testing a web application using VS.NET 2003, VB, .NET
>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>> computer.  I'm using a web form.
>>
>> I'm trying create a function in javascript to compare dates between
>> calendar selected dates(that's not really my problem yet).
>>
>> I can't get the html to recognize the function that i have created.  When
>> i run the program, it gives the error
>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>> 'ASP.WebForm1_aspx'
>> Source Error:
>>
>>
>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
>> 16px; POSITION: absolute; TOP: 16px" runat="server"
>> Line 78: Height="72px"
>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>> Line 79: <asp:button id="btnGetArchivedTrips" onclick="btnGAT_onClick();"
>> style="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 152px"
>> Line 80: accessKey="G" runat="server" Width="128px" BorderStyle="Solid"
>> ForeColor="OrangeRed" BackColor="White"
>> Line 81: Text="Get Archived Trips"></asp:button>
>>
>>
>> Here is my html:
>>  <script id=clientEventHandlersJS language=javascript>
>> <!--
>> function document_onclick() {
>> }
>>
>> //-->
>> </script>
>> <script language=javascript for=document event=onclick>
>> <!--
>> function btnGAT_onClick() {
>> var startDate = calendar1.selected.date
>> var endDate = calendar2.selected.date
>> }
>> return document_onclick()
>> //-->
>> </script>
>>
>> I have this line in the Page_load event:
>>
>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>> btnGAT_onClick()")
>>
>> Why is it not finding that function ?
>>
>> Any help would be gratefully appreciated.
>>
>> Thanks,
>> Tony
>>
>>
>
>
Author
5 Oct 2006 2:42 PM
Ken Cox [Microsoft MVP]
Hi Tony,

I think it would be better if you explained what you are trying to
accomplish.

Your client-side function,  btnGAT_onClick() , contains server-side
properties (calendar1.selecteddate) that JavaScript isn't going to accept.

As I said previously, you're mixing client-side and server-side code in a
way that won't work.

Ken
Microsoft MVP [ASP.NET]


Show quoteHide quote
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:%23f0A4o$5GHA.4832@TK2MSFTNGP06.phx.gbl...
> Hello Ken.
>
> That succeeded in eliminating the error, but it doesn't seem to be
> executing my function.
> }
> function btnGAT_onClick() {
> var startDate = calendar1.selecteddate
> var endDate = calendar2.selecteddate
> if startDate > endDate
> alert('Incorrect dates')
> end if
> }
>
> Is there a way to stop it in the debugger to see what's going on ?
>
> Thanks,
> Tony
>
> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
> message news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
>> Hey Tony,
>>
>> You're mixing server-side clicks and client-side scripts inappropriately.
>>
>> Try taking this out of your server-side code:
>>
>> onclick="btnGAT_onClick();"
>>
>> It looks like you might be doing the same with the calendar too.
>>
>> Ken
>>
>>
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>>> Hello.
>>>
>>> I'm developing and testing a web application using VS.NET 2003, VB, .NET
>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>>> computer.  I'm using a web form.
>>>
>>> I'm trying create a function in javascript to compare dates between
>>> calendar selected dates(that's not really my problem yet).
>>>
>>> I can't get the html to recognize the function that i have created.
>>> When i run the program, it gives the error
>>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>>> 'ASP.WebForm1_aspx'
>>> Source Error:
>>>
>>>
>>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
>>> 16px; POSITION: absolute; TOP: 16px" runat="server"
>>> Line 78: Height="72px"
>>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>>> Line 79: <asp:button id="btnGetArchivedTrips"
>>> onclick="btnGAT_onClick();" style="Z-INDEX: 104; LEFT: 168px; POSITION:
>>> absolute; TOP: 152px"
>>> Line 80: accessKey="G" runat="server" Width="128px" BorderStyle="Solid"
>>> ForeColor="OrangeRed" BackColor="White"
>>> Line 81: Text="Get Archived Trips"></asp:button>
>>>
>>>
>>> Here is my html:
>>>  <script id=clientEventHandlersJS language=javascript>
>>> <!--
>>> function document_onclick() {
>>> }
>>>
>>> //-->
>>> </script>
>>> <script language=javascript for=document event=onclick>
>>> <!--
>>> function btnGAT_onClick() {
>>> var startDate = calendar1.selected.date
>>> var endDate = calendar2.selected.date
>>> }
>>> return document_onclick()
>>> //-->
>>> </script>
>>>
>>> I have this line in the Page_load event:
>>>
>>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>>> btnGAT_onClick()")
>>>
>>> Why is it not finding that function ?
>>>
>>> Any help would be gratefully appreciated.
>>>
>>> Thanks,
>>> Tony
>>>
>>>
>>
>>
>
>
Author
5 Oct 2006 3:44 PM
Tony Girgenti
Hello Ken.

On the web page i have two calendar controls.  I want to be able to compare
one calendar selecteddate(start date) to the other calendar selecteddate
(end date) and give the operator a warning screen if the start date is > the
end date.

Of course this should occur after they click the start button which is also
on the web form.

Any help that you can provide to accomplish this would be gratefully
appreciated.

Thanks,
Tony
Show quoteHide quote
"Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in message
news:%233z4IyI6GHA.3732@TK2MSFTNGP05.phx.gbl...
> Hi Tony,
>
> I think it would be better if you explained what you are trying to
> accomplish.
>
> Your client-side function,  btnGAT_onClick() , contains server-side
> properties (calendar1.selecteddate) that JavaScript isn't going to accept.
>
> As I said previously, you're mixing client-side and server-side code in a
> way that won't work.
>
> Ken
> Microsoft MVP [ASP.NET]
>
>
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:%23f0A4o$5GHA.4832@TK2MSFTNGP06.phx.gbl...
>> Hello Ken.
>>
>> That succeeded in eliminating the error, but it doesn't seem to be
>> executing my function.
>> }
>> function btnGAT_onClick() {
>> var startDate = calendar1.selecteddate
>> var endDate = calendar2.selecteddate
>> if startDate > endDate
>> alert('Incorrect dates')
>> end if
>> }
>>
>> Is there a way to stop it in the debugger to see what's going on ?
>>
>> Thanks,
>> Tony
>>
>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>> message news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
>>> Hey Tony,
>>>
>>> You're mixing server-side clicks and client-side scripts
>>> inappropriately.
>>>
>>> Try taking this out of your server-side code:
>>>
>>> onclick="btnGAT_onClick();"
>>>
>>> It looks like you might be doing the same with the calendar too.
>>>
>>> Ken
>>>
>>>
>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>>>> Hello.
>>>>
>>>> I'm developing and testing a web application using VS.NET 2003, VB,
>>>> .NET
>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>>>> computer.  I'm using a web form.
>>>>
>>>> I'm trying create a function in javascript to compare dates between
>>>> calendar selected dates(that's not really my problem yet).
>>>>
>>>> I can't get the html to recognize the function that i have created.
>>>> When i run the program, it gives the error
>>>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>>>> 'ASP.WebForm1_aspx'
>>>> Source Error:
>>>>
>>>>
>>>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>>>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
>>>> 16px; POSITION: absolute; TOP: 16px" runat="server"
>>>> Line 78: Height="72px"
>>>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>>>> Line 79: <asp:button id="btnGetArchivedTrips"
>>>> onclick="btnGAT_onClick();" style="Z-INDEX: 104; LEFT: 168px; POSITION:
>>>> absolute; TOP: 152px"
>>>> Line 80: accessKey="G" runat="server" Width="128px" BorderStyle="Solid"
>>>> ForeColor="OrangeRed" BackColor="White"
>>>> Line 81: Text="Get Archived Trips"></asp:button>
>>>>
>>>>
>>>> Here is my html:
>>>>  <script id=clientEventHandlersJS language=javascript>
>>>> <!--
>>>> function document_onclick() {
>>>> }
>>>>
>>>> //-->
>>>> </script>
>>>> <script language=javascript for=document event=onclick>
>>>> <!--
>>>> function btnGAT_onClick() {
>>>> var startDate = calendar1.selected.date
>>>> var endDate = calendar2.selected.date
>>>> }
>>>> return document_onclick()
>>>> //-->
>>>> </script>
>>>>
>>>> I have this line in the Page_load event:
>>>>
>>>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>>>> btnGAT_onClick()")
>>>>
>>>> Why is it not finding that function ?
>>>>
>>>> Any help would be gratefully appreciated.
>>>>
>>>> Thanks,
>>>> Tony
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
5 Oct 2006 4:05 PM
Ken Cox [Microsoft MVP]
Hi Tony,

Perhaps if you take a look at this sample, you'll get the idea. It tests the
selected dates and calculates the difference. You proceed if the difference
is correct.

Ken
Microsoft MVP [ASP.NET]

<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    Protected Sub Button1_Click _
    (ByVal sender As Object, _
    ByVal e As System.EventArgs)
        Dim dtCal1 As DateTime
        Dim dtCal2 As DateTime
        Dim tmspan As TimeSpan
        dtCal1 = Calendar1.SelectedDate
        dtCal2 = Calendar2.SelectedDate
        tmspan = dtCal2.Subtract(dtCal1)
        If (tmspan.TotalDays < 0) Then
            Label1.Text = "Oops. Your End date is " & _
            " before the Start date!"
        Else
            Label1.Text = "Processing...The difference is " & _
              tmspan.TotalDays.ToString & " day(s)."
        End If

    End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Days Difference</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>Start Date
            <asp:calendar id="Calendar1" runat="server"></asp:calendar>
            <br />End Date
            <asp:calendar id="Calendar2" runat="server"></asp:calendar>
            <br />
            <asp:label id="Label1" runat="server"></asp:label>
            <br />
            <br />
            <asp:button id="Button1" runat="server" onclick="Button1_Click"
text="Calculate" /></div>
    </form>
</body>
</html>

Show quoteHide quote
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:uh8UNWJ6GHA.3836@TK2MSFTNGP02.phx.gbl...
> Hello Ken.
>
> On the web page i have two calendar controls.  I want to be able to
> compare one calendar selecteddate(start date) to the other calendar
> selecteddate (end date) and give the operator a warning screen if the
> start date is > the end date.
>
> Of course this should occur after they click the start button which is
> also on the web form.
>
> Any help that you can provide to accomplish this would be gratefully
> appreciated.
>
> Thanks,
> Tony
> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
> message news:%233z4IyI6GHA.3732@TK2MSFTNGP05.phx.gbl...
>> Hi Tony,
>>
>> I think it would be better if you explained what you are trying to
>> accomplish.
>>
>> Your client-side function,  btnGAT_onClick() , contains server-side
>> properties (calendar1.selecteddate) that JavaScript isn't going to
>> accept.
>>
>> As I said previously, you're mixing client-side and server-side code in a
>> way that won't work.
>>
>> Ken
>> Microsoft MVP [ASP.NET]
>>
>>
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:%23f0A4o$5GHA.4832@TK2MSFTNGP06.phx.gbl...
>>> Hello Ken.
>>>
>>> That succeeded in eliminating the error, but it doesn't seem to be
>>> executing my function.
>>> }
>>> function btnGAT_onClick() {
>>> var startDate = calendar1.selecteddate
>>> var endDate = calendar2.selecteddate
>>> if startDate > endDate
>>> alert('Incorrect dates')
>>> end if
>>> }
>>>
>>> Is there a way to stop it in the debugger to see what's going on ?
>>>
>>> Thanks,
>>> Tony
>>>
>>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>>> message news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
>>>> Hey Tony,
>>>>
>>>> You're mixing server-side clicks and client-side scripts
>>>> inappropriately.
>>>>
>>>> Try taking this out of your server-side code:
>>>>
>>>> onclick="btnGAT_onClick();"
>>>>
>>>> It looks like you might be doing the same with the calendar too.
>>>>
>>>> Ken
>>>>
>>>>
>>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>>> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>>>>> Hello.
>>>>>
>>>>> I'm developing and testing a web application using VS.NET 2003, VB,
>>>>> .NET
>>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>>>>> computer.  I'm using a web form.
>>>>>
>>>>> I'm trying create a function in javascript to compare dates between
>>>>> calendar selected dates(that's not really my problem yet).
>>>>>
>>>>> I can't get the html to recognize the function that i have created.
>>>>> When i run the program, it gives the error
>>>>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>>>>> 'ASP.WebForm1_aspx'
>>>>> Source Error:
>>>>>
>>>>>
>>>>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>>>>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
>>>>> 16px; POSITION: absolute; TOP: 16px" runat="server"
>>>>> Line 78: Height="72px"
>>>>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>>>>> Line 79: <asp:button id="btnGetArchivedTrips"
>>>>> onclick="btnGAT_onClick();" style="Z-INDEX: 104; LEFT: 168px;
>>>>> POSITION: absolute; TOP: 152px"
>>>>> Line 80: accessKey="G" runat="server" Width="128px"
>>>>> BorderStyle="Solid" ForeColor="OrangeRed" BackColor="White"
>>>>> Line 81: Text="Get Archived Trips"></asp:button>
>>>>>
>>>>>
>>>>> Here is my html:
>>>>>  <script id=clientEventHandlersJS language=javascript>
>>>>> <!--
>>>>> function document_onclick() {
>>>>> }
>>>>>
>>>>> //-->
>>>>> </script>
>>>>> <script language=javascript for=document event=onclick>
>>>>> <!--
>>>>> function btnGAT_onClick() {
>>>>> var startDate = calendar1.selected.date
>>>>> var endDate = calendar2.selected.date
>>>>> }
>>>>> return document_onclick()
>>>>> //-->
>>>>> </script>
>>>>>
>>>>> I have this line in the Page_load event:
>>>>>
>>>>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>>>>> btnGAT_onClick()")
>>>>>
>>>>> Why is it not finding that function ?
>>>>>
>>>>> Any help would be gratefully appreciated.
>>>>>
>>>>> Thanks,
>>>>> Tony
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
5 Oct 2006 6:42 PM
Tony Girgenti
Wow Ken.

I wasn't expecting for you to do the whole thing.  Or did you copy it from
somewhere ?

I was simply looking for direction on how to get started, but thanks for all
of your effort.

Tony

Show quoteHide quote
"Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in message
news:e9TthgJ6GHA.4816@TK2MSFTNGP06.phx.gbl...
> Hi Tony,
>
> Perhaps if you take a look at this sample, you'll get the idea. It tests
> the selected dates and calculates the difference. You proceed if the
> difference is correct.
>
> Ken
> Microsoft MVP [ASP.NET]
>
> <%@ page language="VB" %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <script runat="server">
>    Protected Sub Button1_Click _
>    (ByVal sender As Object, _
>    ByVal e As System.EventArgs)
>        Dim dtCal1 As DateTime
>        Dim dtCal2 As DateTime
>        Dim tmspan As TimeSpan
>        dtCal1 = Calendar1.SelectedDate
>        dtCal2 = Calendar2.SelectedDate
>        tmspan = dtCal2.Subtract(dtCal1)
>        If (tmspan.TotalDays < 0) Then
>            Label1.Text = "Oops. Your End date is " & _
>            " before the Start date!"
>        Else
>            Label1.Text = "Processing...The difference is " & _
>              tmspan.TotalDays.ToString & " day(s)."
>        End If
>
>    End Sub
> </script>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
>    <title>Days Difference</title>
> </head>
> <body>
>    <form id="form1" runat="server">
>        <div>Start Date
>            <asp:calendar id="Calendar1" runat="server"></asp:calendar>
>            <br />End Date
>            <asp:calendar id="Calendar2" runat="server"></asp:calendar>
>            <br />
>            <asp:label id="Label1" runat="server"></asp:label>
>            <br />
>            <br />
>            <asp:button id="Button1" runat="server" onclick="Button1_Click"
> text="Calculate" /></div>
>    </form>
> </body>
> </html>
>
> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
> news:uh8UNWJ6GHA.3836@TK2MSFTNGP02.phx.gbl...
>> Hello Ken.
>>
>> On the web page i have two calendar controls.  I want to be able to
>> compare one calendar selecteddate(start date) to the other calendar
>> selecteddate (end date) and give the operator a warning screen if the
>> start date is > the end date.
>>
>> Of course this should occur after they click the start button which is
>> also on the web form.
>>
>> Any help that you can provide to accomplish this would be gratefully
>> appreciated.
>>
>> Thanks,
>> Tony
>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>> message news:%233z4IyI6GHA.3732@TK2MSFTNGP05.phx.gbl...
>>> Hi Tony,
>>>
>>> I think it would be better if you explained what you are trying to
>>> accomplish.
>>>
>>> Your client-side function,  btnGAT_onClick() , contains server-side
>>> properties (calendar1.selecteddate) that JavaScript isn't going to
>>> accept.
>>>
>>> As I said previously, you're mixing client-side and server-side code in
>>> a way that won't work.
>>>
>>> Ken
>>> Microsoft MVP [ASP.NET]
>>>
>>>
>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>> news:%23f0A4o$5GHA.4832@TK2MSFTNGP06.phx.gbl...
>>>> Hello Ken.
>>>>
>>>> That succeeded in eliminating the error, but it doesn't seem to be
>>>> executing my function.
>>>> }
>>>> function btnGAT_onClick() {
>>>> var startDate = calendar1.selecteddate
>>>> var endDate = calendar2.selecteddate
>>>> if startDate > endDate
>>>> alert('Incorrect dates')
>>>> end if
>>>> }
>>>>
>>>> Is there a way to stop it in the debugger to see what's going on ?
>>>>
>>>> Thanks,
>>>> Tony
>>>>
>>>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>>>> message news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
>>>>> Hey Tony,
>>>>>
>>>>> You're mixing server-side clicks and client-side scripts
>>>>> inappropriately.
>>>>>
>>>>> Try taking this out of your server-side code:
>>>>>
>>>>> onclick="btnGAT_onClick();"
>>>>>
>>>>> It looks like you might be doing the same with the calendar too.
>>>>>
>>>>> Ken
>>>>>
>>>>>
>>>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>>>> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>>>>>> Hello.
>>>>>>
>>>>>> I'm developing and testing a web application using VS.NET 2003, VB,
>>>>>> .NET
>>>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>>>>>> computer.  I'm using a web form.
>>>>>>
>>>>>> I'm trying create a function in javascript to compare dates between
>>>>>> calendar selected dates(that's not really my problem yet).
>>>>>>
>>>>>> I can't get the html to recognize the function that i have created.
>>>>>> When i run the program, it gives the error
>>>>>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>>>>>> 'ASP.WebForm1_aspx'
>>>>>> Source Error:
>>>>>>
>>>>>>
>>>>>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>>>>>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105; LEFT:
>>>>>> 16px; POSITION: absolute; TOP: 16px" runat="server"
>>>>>> Line 78: Height="72px"
>>>>>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>>>>>> Line 79: <asp:button id="btnGetArchivedTrips"
>>>>>> onclick="btnGAT_onClick();" style="Z-INDEX: 104; LEFT: 168px;
>>>>>> POSITION: absolute; TOP: 152px"
>>>>>> Line 80: accessKey="G" runat="server" Width="128px"
>>>>>> BorderStyle="Solid" ForeColor="OrangeRed" BackColor="White"
>>>>>> Line 81: Text="Get Archived Trips"></asp:button>
>>>>>>
>>>>>>
>>>>>> Here is my html:
>>>>>>  <script id=clientEventHandlersJS language=javascript>
>>>>>> <!--
>>>>>> function document_onclick() {
>>>>>> }
>>>>>>
>>>>>> //-->
>>>>>> </script>
>>>>>> <script language=javascript for=document event=onclick>
>>>>>> <!--
>>>>>> function btnGAT_onClick() {
>>>>>> var startDate = calendar1.selected.date
>>>>>> var endDate = calendar2.selected.date
>>>>>> }
>>>>>> return document_onclick()
>>>>>> //-->
>>>>>> </script>
>>>>>>
>>>>>> I have this line in the Page_load event:
>>>>>>
>>>>>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>>>>>> btnGAT_onClick()")
>>>>>>
>>>>>> Why is it not finding that function ?
>>>>>>
>>>>>> Any help would be gratefully appreciated.
>>>>>>
>>>>>> Thanks,
>>>>>> Tony
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
5 Oct 2006 6:46 PM
Ken Cox [Microsoft MVP]
Hi Tony,

I had done something similar before, so I had most of the code.

Glad to help!

Ken
Microsoft MVP [ASP.NET]

Show quoteHide quote
"Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
news:%23eZmA4K6GHA.4580@TK2MSFTNGP03.phx.gbl...
> Wow Ken.
>
> I wasn't expecting for you to do the whole thing.  Or did you copy it from
> somewhere ?
>
> I was simply looking for direction on how to get started, but thanks for
> all of your effort.
>
> Tony
>
> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
> message news:e9TthgJ6GHA.4816@TK2MSFTNGP06.phx.gbl...
>> Hi Tony,
>>
>> Perhaps if you take a look at this sample, you'll get the idea. It tests
>> the selected dates and calculates the difference. You proceed if the
>> difference is correct.
>>
>> Ken
>> Microsoft MVP [ASP.NET]
>>
>> <%@ page language="VB" %>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <script runat="server">
>>    Protected Sub Button1_Click _
>>    (ByVal sender As Object, _
>>    ByVal e As System.EventArgs)
>>        Dim dtCal1 As DateTime
>>        Dim dtCal2 As DateTime
>>        Dim tmspan As TimeSpan
>>        dtCal1 = Calendar1.SelectedDate
>>        dtCal2 = Calendar2.SelectedDate
>>        tmspan = dtCal2.Subtract(dtCal1)
>>        If (tmspan.TotalDays < 0) Then
>>            Label1.Text = "Oops. Your End date is " & _
>>            " before the Start date!"
>>        Else
>>            Label1.Text = "Processing...The difference is " & _
>>              tmspan.TotalDays.ToString & " day(s)."
>>        End If
>>
>>    End Sub
>> </script>
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head runat="server">
>>    <title>Days Difference</title>
>> </head>
>> <body>
>>    <form id="form1" runat="server">
>>        <div>Start Date
>>            <asp:calendar id="Calendar1" runat="server"></asp:calendar>
>>            <br />End Date
>>            <asp:calendar id="Calendar2" runat="server"></asp:calendar>
>>            <br />
>>            <asp:label id="Label1" runat="server"></asp:label>
>>            <br />
>>            <br />
>>            <asp:button id="Button1" runat="server"
>> onclick="Button1_Click" text="Calculate" /></div>
>>    </form>
>> </body>
>> </html>
>>
>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>> news:uh8UNWJ6GHA.3836@TK2MSFTNGP02.phx.gbl...
>>> Hello Ken.
>>>
>>> On the web page i have two calendar controls.  I want to be able to
>>> compare one calendar selecteddate(start date) to the other calendar
>>> selecteddate (end date) and give the operator a warning screen if the
>>> start date is > the end date.
>>>
>>> Of course this should occur after they click the start button which is
>>> also on the web form.
>>>
>>> Any help that you can provide to accomplish this would be gratefully
>>> appreciated.
>>>
>>> Thanks,
>>> Tony
>>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>>> message news:%233z4IyI6GHA.3732@TK2MSFTNGP05.phx.gbl...
>>>> Hi Tony,
>>>>
>>>> I think it would be better if you explained what you are trying to
>>>> accomplish.
>>>>
>>>> Your client-side function,  btnGAT_onClick() , contains server-side
>>>> properties (calendar1.selecteddate) that JavaScript isn't going to
>>>> accept.
>>>>
>>>> As I said previously, you're mixing client-side and server-side code in
>>>> a way that won't work.
>>>>
>>>> Ken
>>>> Microsoft MVP [ASP.NET]
>>>>
>>>>
>>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>>> news:%23f0A4o$5GHA.4832@TK2MSFTNGP06.phx.gbl...
>>>>> Hello Ken.
>>>>>
>>>>> That succeeded in eliminating the error, but it doesn't seem to be
>>>>> executing my function.
>>>>> }
>>>>> function btnGAT_onClick() {
>>>>> var startDate = calendar1.selecteddate
>>>>> var endDate = calendar2.selecteddate
>>>>> if startDate > endDate
>>>>> alert('Incorrect dates')
>>>>> end if
>>>>> }
>>>>>
>>>>> Is there a way to stop it in the debugger to see what's going on ?
>>>>>
>>>>> Thanks,
>>>>> Tony
>>>>>
>>>>> "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in
>>>>> message news:OVy3kK$5GHA.3644@TK2MSFTNGP03.phx.gbl...
>>>>>> Hey Tony,
>>>>>>
>>>>>> You're mixing server-side clicks and client-side scripts
>>>>>> inappropriately.
>>>>>>
>>>>>> Try taking this out of your server-side code:
>>>>>>
>>>>>> onclick="btnGAT_onClick();"
>>>>>>
>>>>>> It looks like you might be doing the same with the calendar too.
>>>>>>
>>>>>> Ken
>>>>>>
>>>>>>
>>>>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message
>>>>>> news:uJwSMJ%235GHA.2464@TK2MSFTNGP06.phx.gbl...
>>>>>>> Hello.
>>>>>>>
>>>>>>> I'm developing and testing a web application using VS.NET 2003, VB,
>>>>>>> .NET
>>>>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2
>>>>>>> computer.  I'm using a web form.
>>>>>>>
>>>>>>> I'm trying create a function in javascript to compare dates between
>>>>>>> calendar selected dates(that's not really my problem yet).
>>>>>>>
>>>>>>> I can't get the html to recognize the function that i have created.
>>>>>>> When i run the program, it gives the error
>>>>>>> Compiler Error Message: BC30456: 'btnGAT_onClick' is not a member of
>>>>>>> 'ASP.WebForm1_aspx'
>>>>>>> Source Error:
>>>>>>>
>>>>>>>
>>>>>>> Line 77: Font-Size="X-Large" ForeColor="OrangeRed">Coyne Truck Web
>>>>>>> Services</asp:label><asp:image id="Image1" style="Z-INDEX: 105;
>>>>>>> LEFT: 16px; POSITION: absolute; TOP: 16px" runat="server"
>>>>>>> Line 78: Height="72px"
>>>>>>> ImageUrl="file:///C:\Inetpub\wwwroot\CoyneTruckWebServices\images\cc_logo.gif"></asp:image>
>>>>>>> Line 79: <asp:button id="btnGetArchivedTrips"
>>>>>>> onclick="btnGAT_onClick();" style="Z-INDEX: 104; LEFT: 168px;
>>>>>>> POSITION: absolute; TOP: 152px"
>>>>>>> Line 80: accessKey="G" runat="server" Width="128px"
>>>>>>> BorderStyle="Solid" ForeColor="OrangeRed" BackColor="White"
>>>>>>> Line 81: Text="Get Archived Trips"></asp:button>
>>>>>>>
>>>>>>>
>>>>>>> Here is my html:
>>>>>>>  <script id=clientEventHandlersJS language=javascript>
>>>>>>> <!--
>>>>>>> function document_onclick() {
>>>>>>> }
>>>>>>>
>>>>>>> //-->
>>>>>>> </script>
>>>>>>> <script language=javascript for=document event=onclick>
>>>>>>> <!--
>>>>>>> function btnGAT_onClick() {
>>>>>>> var startDate = calendar1.selected.date
>>>>>>> var endDate = calendar2.selected.date
>>>>>>> }
>>>>>>> return document_onclick()
>>>>>>> //-->
>>>>>>> </script>
>>>>>>>
>>>>>>> I have this line in the Page_load event:
>>>>>>>
>>>>>>> Me.btnGetArchivedTrips.Attributes.Add("onclick", "return
>>>>>>> btnGAT_onClick()")
>>>>>>>
>>>>>>> Why is it not finding that function ?
>>>>>>>
>>>>>>> Any help would be gratefully appreciated.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Tony
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>