ASP.NET control using Javascript

K

kplkumar

I have created a asp.net date picker control using Javascript. I wanted
to do this to avoid doing post back when the calendar window is
launched. It works like charm.

But the challenge is - the control does not use any asp.net controls
like button or textfield. It uses html "input" for the text field and
the button. So after the user has choosen the date and the date is
populated in the textfield, I am not able to get the value from the
textfield into my aspx page.

Can someone throw some light here? I cannot be using AJAX and
microsoft's ATLAS (similair to ajax) is not available until the end of
the year.

Help please. Thanks in advance.
 
O

o0JoeCool0o

If you want to send the text field to the server code behind without
ajax, you will have to do a postback to the server. in the designer u
need to right click the text field and go run as server control. to
grab the control I belive u can reference it directly...

if not then you can go

dim myInputBox as HtmlInputText

myInputBox = page.findcontrol("idOfInputBox")

then acces the value with myInputBox.value

hope that helps
 
K

kplkumar

I thought I will put the code as well. This is my code inside the
asp.net control. I have left out the javascript.

<div class="body">
<input type="text" id="DateBox" name="dateText" size="15" />
<input type="image" src="Images/SmallCalendar.gif" name="imageBtn"
onclick="return showCalendar('DateBox', '%Y-%m-%d', '', false);" />
</div>

I need to get the value from "DateBox" into my ascx's property. Is that
possible? If not, any work around?? Thanks.
 

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

Top