Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Prism eigenes WebControl - RadiobuttonList (https://www.delphipraxis.net/68902-eigenes-webcontrol-radiobuttonlist.html)

wabux 7. Mai 2006 22:47


eigenes WebControl - RadiobuttonList
 
Hallo,


ich brauche ein eigenes Webcontrol, ähnlich einer RadioButtonList. Aber ich blicke noch nicht wie ich die einzelnen Tags setzen kann.
Ausserdem würde es mich interessieren, wie man die Arrayliste deklariert, damit man am Propertygrid der Delphi-IDE die einzelnen Items eingeben kann.

so soll es mal aussehen
<input type="Radio" name='countrys,202' value="eu" >Europa

<input type="Radio" name='countrys,202' value="a" >Austria

<input type="Radio" name='countrys,202' value="b" >Belgium

<input type="Radio" name='countrys,202' value="ch" >Switzerland

<input type="Radio" name='countrys,202' value="hr" >Croatia

<input type="Radio" name='countrys,202' value="dk" >Denmark



Kann mir da bitte jemand helfen?

Danke


Delphi-Quellcode:
unit WebControl2;
interface
uses
  System.Web.UI,
  System.Web.UI.WebControls,
  System.ComponentModel,
  System.Collections,
  System.Drawing,
  Borland.Data.Web;

type
  /// <summary>
  /// Summary description for MyWebControl2.
  /// </summary>
  ///    [ToolboxBitmap(typeof('PureWebControl.bmp'),'PureWebControl.bmp' )]
  ///
  [ControlBuilder(typeof(System.Web.UI.WebControls.PlaceHolderControlBuilder)),
  Designer('System.Web.UI.Design.ControlDesigner'),
  DefaultProperty('ID'),
  ToolboxData('<{0}:MyWebControl2 runat=server></{0}:MyWebControl2>')]
  MyWebControl2 = class(System.Web.UI.WebControls.WebControl, INamingContainer)
  strict private
    FText: String;
    FItems : arraylist ;

  strict protected
  // override RenderContents(..) when you inherit from Web.UI.WebControls.WebControl
    procedure RenderContents(Output: HtmlTextWriter); override;
    function GetDesignTimeHtml : string;

   // override Render(..) when you inherit from Web.UI.WebControls.Control
   // procedure Render(Output: HtmlTextWriter); override;
  public
    constructor Create;
  published
      [LocalizableCategoryAttribute('PureWeb'),
        DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
        DefaultValue('')]
    property Items: arraylist read FItems write FItems;

    [Bindable(false),
     Category('Appearance'),
     DefaultValue('')]
    property Text: string read FText write FText;
  end;

implementation

function MyWebControl2.GetDesignTimeHtml : string;
begin
  result := '<h1>Blog</h2><hr/><hr/>';
end;


/// <summary>
/// Define a public parameterless constructor needed by web controls.
/// </summary>
constructor MyWebControl2.Create;
begin
  inherited;
end;

/// <summary>
/// Render this control to the output parameter specified, preserving
/// cosmetic attribute output generation inherited from standard WebControl.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
procedure MyWebControl2.RenderContents(Output: HtmlTextWriter);
begin
  Output.Write(Text);
end;

{$REGION 'Render override'}
(*
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
procedure MyWebControl2.Render(Output: HtmlTextWriter);
begin
  Output.Write(Text);
end;
(* *)
{$ENDREGION}

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:27 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz