Creating a widget

Jul 4, 2014 at 6:53 PM
In my old blog i had a little box with that codes:
<script language=JavaScript>
                var spr=new Array;
                spr[0]="Job1";
                spr[1]="Job2";
            
                function rede()
                {
                num=Math.floor(2*Math.random());
                document.redtab.redfens.value = spr[num]; 
                window.setTimeout("rede()",1000);
                }
                window.setTimeout("rede()",1000);
</script>
and inside the site:
<h2>Sascha Manns</h2>
        <p>your next:</p>
            <div id="your_next">
            <form name="redtab" id="redtab">
            <input type="text" name="redfens" size="25" />
            </form>
</div>
If i want to create a widget i have seen that i must have a widget.ascx and a edit.ascx. What code must in what file to just view that?
Jul 5, 2014 at 11:36 PM
Edited Jul 5, 2014 at 11:37 PM
Now i have:

---widget.ascx----
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="widget.ascx.cs" Inherits="widgets_Yournext_widget" %>
---widget.ascx.cs---
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Widgets.Yournext
{
    using App_Code.Controls;

    /// <summary>
    /// The widget.
    /// </summary>
    public partial class Widget : WidgetBase
    {
        #region Properties

        /// <summary>
        /// Gets a value indicating whether IsEditable.
        /// </summary>
        public override bool IsEditable
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// Gets Name.
        /// </summary>
        public override string Name
        {
            get
            {
                return "Yournext";
            }
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// The load widget.
        /// </summary>
        public override void LoadWidget()
        {
            // Nothing to load
        }

        #endregion
    }
}
My goal is to have a array that contains jobtitles ( "Baker", "Slave", "Pilot" ). The widget should pick a random string from that array and should print out anything like "Your next: Baker". It should be readable for some seconds and then it should pick anothe string to the box.
Any ideas?