JTSOne
JTSOne

Reputation: 169

ASP.NET Web User Control Positioning on Page

I'm an experience programmer who is writing his first asp.net application. I needed a pop up calendar and didn't like the javascript based ones I found. I wrote my own Web User Control thinking that would be best. (I still have some issues with it). I used a textbox, image button and the asp.net calendar control. The control works reasonably well, but not being an HTML/ASP programmer when I placed it on my page, whenever I clicked the button to display the calendar, my page goes horribley misaligned. I placed it inside of a HTML table and that helps. But I was wanting to not worry about control alignment on the page. Am I completely misunderstanding how a Web User Control would display for this time of calendar control? Should I abandon my work and look for a Javascript solution? (But if it's a user control won't it do the same thing?

Upvotes: 2

Views: 744

Answers (2)

stuartsmithuk
stuartsmithuk

Reputation: 31

It's worth spending some time learning how jQuery UI and the datepicker() plugin work. I'm guessing by your original post that you are not too keen on a client side solution, but I rarely see a need for a server side calendar control.

Javascript/jQuery

<script type="text/javascript">
$(document).ready(function() {
$("#myTextBox").datepicker();
});
</script>

HTML

<script type="text/javascript" src="<jQuery URL GOES HERE>" />
<script type="text/javascript" src="<jQueryUI URL GOES HERE>" />
<input type="text" id="myTextBox />

Apologies if the syntax is a bit off... I dont have VS in front of me to test but hopefully it should give you an idea where to start :)

Upvotes: 0

Bobby Borszich
Bobby Borszich

Reputation: 11767

While this is a good item to learn with it certainly has been done, and done very well in many places.

Any server based calendar control is not your best option, it will lead to a postback anytime you are switching from month to month, which is less then ideal.

jQueryUI is a great/simple option to get a calendar control that will not mess up your other layout.

In the end if you still want to implement your control we will need to see some HTML/CSS as to why it is messing up your UI.

Upvotes: 0

Related Questions