Home All Groups Group Topic Archive Search About

Use windows control in asp.net 2.0

Author
29 Mar 2006 1:49 PM
YC
Hi,
I'm trying to use a calendar windows control within a an asp.net 2.0
application.
I've created a windows control library project that holds the calendar.
I placed the DLL within the web application direcory.
All is well and I can declaretivly set the default date using the "Param"
within the object tag.
The problem is that I can't get the value with the public property I created
in the windows user control - when I try to acces it from client side script
I get an "undfined" error. I just can't access the public propett from code -
only from teh Param in the object tag.


How can I get the value of the calendar from the web application?

Thanks

Yoav

Author
29 Mar 2006 2:38 PM
Phillip Williams
Hi Yoav:

The value returned by your Windows user control will be available through
the Request.Form property using the id you gave to the control.  To get a
better understanding of the variables collection that is exposed by the Form
property, add a submit button on your form and add the following code in your
codebehind module:

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
        Dim i As Integer
        For i = 0 To Request.Form.Keys.Count - 1
            Response.Write("Request.Form.Key value " & Request.Form.Keys(i)
& " has value " & Request.Form.Item(Request.Form.Keys(i)) & "<br/>")

        Next
    End Sub

Show quoteHide quote
"YC" wrote:

> Hi,
> I'm trying to use a calendar windows control within a an asp.net 2.0
> application.
> I've created a windows control library project that holds the calendar.
> I placed the DLL within the web application direcory.
> All is well and I can declaretivly set the default date using the "Param"
> within the object tag.
> The problem is that I can't get the value with the public property I created
> in the windows user control - when I try to acces it from client side script
> I get an "undfined" error. I just can't access the public propett from code -
> only from teh Param in the object tag.
>
>
> How can I get the value of the calendar from the web application?
>
> Thanks
>
> Yoav
Author
29 Mar 2006 3:18 PM
YC
Hi Philip,
Thanks for your reply.

I can't find the control in the Request.Form collection,
the control isn't runat=server, I don't see it's value in the request at all.

Yoav

Show quoteHide quote
"Phillip Williams" wrote:

> Hi Yoav:
>
> The value returned by your Windows user control will be available through
> the Request.Form property using the id you gave to the control.  To get a
> better understanding of the variables collection that is exposed by the Form
> property, add a submit button on your form and add the following code in your
> codebehind module:
>
>     Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnSubmit.Click
>         Dim i As Integer
>         For i = 0 To Request.Form.Keys.Count - 1
>             Response.Write("Request.Form.Key value " & Request.Form.Keys(i)
> & " has value " & Request.Form.Item(Request.Form.Keys(i)) & "<br/>")
>
>         Next
>     End Sub
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "YC" wrote:
>
> > Hi,
> > I'm trying to use a calendar windows control within a an asp.net 2.0
> > application.
> > I've created a windows control library project that holds the calendar.
> > I placed the DLL within the web application direcory.
> > All is well and I can declaretivly set the default date using the "Param"
> > within the object tag.
> > The problem is that I can't get the value with the public property I created
> > in the windows user control - when I try to acces it from client side script
> > I get an "undfined" error. I just can't access the public propett from code -
> > only from teh Param in the object tag.
> >
> >
> > How can I get the value of the calendar from the web application?
> >
> > Thanks
> >
> > Yoav
Author
29 Mar 2006 3:49 PM
Phillip Williams
It does not have to runat server but you got to set a value for its name
property (not its ID property) in order for the form variables collection to
create a key for it, e.g.

<OBJECT codeBase="controls/mscomct2.cab"
    classid="clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
    name="DatePickerStart" VIEWASTEXT>
    <PARAM NAME="CalendarBackColor" VALUE="-2147483643">
    <PARAM NAME="CalendarForeColor" VALUE="-2147483630">
</OBJECT>

Show quoteHide quote
"YC" wrote:

> Hi Philip,
> Thanks for your reply.
>
> I can't find the control in the Request.Form collection,
> the control isn't runat=server, I don't see it's value in the request at all.
>
> Yoav
>
> "Phillip Williams" wrote:
>
> > Hi Yoav:
> >
> > The value returned by your Windows user control will be available through
> > the Request.Form property using the id you gave to the control.  To get a
> > better understanding of the variables collection that is exposed by the Form
> > property, add a submit button on your form and add the following code in your
> > codebehind module:
> >
> >     Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles btnSubmit.Click
> >         Dim i As Integer
> >         For i = 0 To Request.Form.Keys.Count - 1
> >             Response.Write("Request.Form.Key value " & Request.Form.Keys(i)
> > & " has value " & Request.Form.Item(Request.Form.Keys(i)) & "<br/>")
> >
> >         Next
> >     End Sub
> >
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "YC" wrote:
> >
> > > Hi,
> > > I'm trying to use a calendar windows control within a an asp.net 2.0
> > > application.
> > > I've created a windows control library project that holds the calendar.
> > > I placed the DLL within the web application direcory.
> > > All is well and I can declaretivly set the default date using the "Param"
> > > within the object tag.
> > > The problem is that I can't get the value with the public property I created
> > > in the windows user control - when I try to acces it from client side script
> > > I get an "undfined" error. I just can't access the public propett from code -
> > > only from teh Param in the object tag.
> > >
> > >
> > > How can I get the value of the calendar from the web application?
> > >
> > > Thanks
> > >
> > > Yoav
Author
29 Mar 2006 3:58 PM
YC
Hi,
It has the Name propety set, it doesn't work.
I'll keep trying.

Thanks again.

Yoav

Show quoteHide quote
"Phillip Williams" wrote:

> It does not have to runat server but you got to set a value for its name
> property (not its ID property) in order for the form variables collection to
> create a key for it, e.g.
>
> <OBJECT codeBase="controls/mscomct2.cab"
>     classid="clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
>     name="DatePickerStart" VIEWASTEXT>
>     <PARAM NAME="CalendarBackColor" VALUE="-2147483643">
>     <PARAM NAME="CalendarForeColor" VALUE="-2147483630">
> </OBJECT>
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "YC" wrote:
>
> > Hi Philip,
> > Thanks for your reply.
> >
> > I can't find the control in the Request.Form collection,
> > the control isn't runat=server, I don't see it's value in the request at all.
> >
> > Yoav
> >
> > "Phillip Williams" wrote:
> >
> > > Hi Yoav:
> > >
> > > The value returned by your Windows user control will be available through
> > > the Request.Form property using the id you gave to the control.  To get a
> > > better understanding of the variables collection that is exposed by the Form
> > > property, add a submit button on your form and add the following code in your
> > > codebehind module:
> > >
> > >     Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles btnSubmit.Click
> > >         Dim i As Integer
> > >         For i = 0 To Request.Form.Keys.Count - 1
> > >             Response.Write("Request.Form.Key value " & Request.Form.Keys(i)
> > > & " has value " & Request.Form.Item(Request.Form.Keys(i)) & "<br/>")
> > >
> > >         Next
> > >     End Sub
> > >
> > > --
> > > HTH,
> > > Phillip Williams
> > > http://www.societopia.net
> > > http://www.webswapp.com
> > >
> > >
> > > "YC" wrote:
> > >
> > > > Hi,
> > > > I'm trying to use a calendar windows control within a an asp.net 2.0
> > > > application.
> > > > I've created a windows control library project that holds the calendar.
> > > > I placed the DLL within the web application direcory.
> > > > All is well and I can declaretivly set the default date using the "Param"
> > > > within the object tag.
> > > > The problem is that I can't get the value with the public property I created
> > > > in the windows user control - when I try to acces it from client side script
> > > > I get an "undfined" error. I just can't access the public propett from code -
> > > > only from teh Param in the object tag.
> > > >
> > > >
> > > > How can I get the value of the calendar from the web application?
> > > >
> > > > Thanks
> > > >
> > > > Yoav
Author
30 Mar 2006 10:07 AM
YC
Hi,
I solved this issue - I just needed to set the ComVisible to true in the
AssemblyInfo
within the windows control library project.

Thanks for your help.

Yoav

Show quoteHide quote
"YC" wrote:

> Hi,
> It has the Name propety set, it doesn't work.
> I'll keep trying.
>
> Thanks again.
>
> Yoav
>
> "Phillip Williams" wrote:
>
> > It does not have to runat server but you got to set a value for its name
> > property (not its ID property) in order for the form variables collection to
> > create a key for it, e.g.
> >
> > <OBJECT codeBase="controls/mscomct2.cab"
> >     classid="clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
> >     name="DatePickerStart" VIEWASTEXT>
> >     <PARAM NAME="CalendarBackColor" VALUE="-2147483643">
> >     <PARAM NAME="CalendarForeColor" VALUE="-2147483630">
> > </OBJECT>
> >
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "YC" wrote:
> >
> > > Hi Philip,
> > > Thanks for your reply.
> > >
> > > I can't find the control in the Request.Form collection,
> > > the control isn't runat=server, I don't see it's value in the request at all.
> > >
> > > Yoav
> > >
> > > "Phillip Williams" wrote:
> > >
> > > > Hi Yoav:
> > > >
> > > > The value returned by your Windows user control will be available through
> > > > the Request.Form property using the id you gave to the control.  To get a
> > > > better understanding of the variables collection that is exposed by the Form
> > > > property, add a submit button on your form and add the following code in your
> > > > codebehind module:
> > > >
> > > >     Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles btnSubmit.Click
> > > >         Dim i As Integer
> > > >         For i = 0 To Request.Form.Keys.Count - 1
> > > >             Response.Write("Request.Form.Key value " & Request.Form.Keys(i)
> > > > & " has value " & Request.Form.Item(Request.Form.Keys(i)) & "<br/>")
> > > >
> > > >         Next
> > > >     End Sub
> > > >
> > > > --
> > > > HTH,
> > > > Phillip Williams
> > > > http://www.societopia.net
> > > > http://www.webswapp.com
> > > >
> > > >
> > > > "YC" wrote:
> > > >
> > > > > Hi,
> > > > > I'm trying to use a calendar windows control within a an asp.net 2.0
> > > > > application.
> > > > > I've created a windows control library project that holds the calendar.
> > > > > I placed the DLL within the web application direcory.
> > > > > All is well and I can declaretivly set the default date using the "Param"
> > > > > within the object tag.
> > > > > The problem is that I can't get the value with the public property I created
> > > > > in the windows user control - when I try to acces it from client side script
> > > > > I get an "undfined" error. I just can't access the public propett from code -
> > > > > only from teh Param in the object tag.
> > > > >
> > > > >
> > > > > How can I get the value of the calendar from the web application?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Yoav