Use windows control in asp.net 2.0

Y

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
 
P

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
 
Y

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
 
P

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>
 
Y

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
 

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
474,137
Messages
2,570,795
Members
47,342
Latest member
eixataze

Latest Threads

Top