writing ajax enabled custom server control

T

ton

Hi,

I found a piece of code where a textbox combined with a image url (looks
like a month view) was AJAX enabled (with the CalendarExtender) . It works
extremely well.
Just clicking on the image and a small calendar appeared on the web page. I
want to use this code to create a custom server control which can use this
feature. I would name this control txtDateField and will use it in a
different customserver control which shows the record of any table in a
database. But so created that depending of the fieldtype a textbox or
combobox or my txtDatefield would be used. Believe it, it is simple when
ready for the rest of the development proces. Here is the code:

<b>Calendar with an associated button:</b><br />
<asp:TextBox runat="server" ID="Date5" />
<asp:Image runat="Server" ID="Image1"
ImageUrl="Calendar_scheduleHS.png" /><br />
<ajaxToolkit:CalendarExtender ID="calendarButtonExtender"
runat="server"
TargetControlID="Date5"
Format="d MMMM yyyy"
PopupButtonID="Image1" />
<div style="font-size: 90%"><em>(Click the image button to show the
calendar; this calendar dismisses automatically when you choose a
date)</em></div>
</div>
Now on the webpage there is offcourse a scriptmanager. But how could this be
fixed in a custom control. Any ideas?

I did found some answers in a different example: it was a mediaplay ajax
enable button (just changed the button on clicking on it) But in stead of a
normal customserver control this control was added tot the project as a
class file. here is som code of this class:
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Collections.Generic

Namespace HDI.AJAX.Controls

Public Class MediaPlayerButton
Inherits Image
Implements IScriptControl

Private _playImageUrl As String
Private _pauseImageUrl As String
Private _scriptManager As ScriptManager

Now I'm trying to put these things together in the customservercontrol. But
I receive an error on
"Implements IScriptControl" and
"Private _scriptManager As ScriptManager"

so how can i solve this

thank you very much

Ton
 

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
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top