Problem with a Server Control I'm building

G

Guest

using System;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using System.Collections;

namespace FTextBox
{
/* Primary class that renders the control output.*/
[DefaultProperty("Text"), ToolboxData("<{0}:FTable
runat=server></{0}:FTable>")]

public class FTable: System.Web.UI.Control
{
// Renders the control and does not take any properties.
// Inherits the properties from other classes as follows:
// SButton - Renders the buttons which loops through the SButtonItem indix.
// SButton in tern inherits from SButtonItem.

protected override void Render(HtmlTextWriter writer)
{
if(base.Visible)
{
writer.WriteBeginTag("table");
writer.WriteAttribute("width","100%");
writer.WriteAttribute("height","100%");

/* Write Attributes following the above statement */

writer.Write(HtmlTextWriter.SelfClosingTagEnd);
writer.WriteFullBeginTag("tr");
ButtonOutput(writer);
writer.WriteEndTag("tr");
writer.WriteLine();
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
TextArea(writer);
writer.RenderEndTag();
writer.RenderEndTag();
writer.WriteEndTag("Table");
}
}
private sButton _Buttons=new sButton();

public sButton Buttons()
{
return _Buttons;
}
protected void ButtonOutput(HtmlTextWriter writer)
{
foreach(sButtonItem pButton in Buttons())
{
writer.Write(pButton.buttonimg);
}
}
protected void TextArea(HtmlTextWriter writer)
{
writer.WriteBeginTag("textarea");
writer.WriteAttribute("cols","100%");
writer.WriteAttribute("rows","100%");
writer.Write(HtmlTextWriter.SelfClosingTagEnd);
writer.WriteEndTag("textarea");
}
}
// Pass the following properties to the sButton class:
// I need to iterate through the collection of sButton Items and build a
container cell.
// the iteration will then fill the Button output method.
// sButton class allows the user to create, add, index and remove new
buttons.

public class sButton : CollectionBase
{
public sButtonItem this[int index]
{
get{return((sButtonItem)List[index]);}
set{List[index]=value;}
}
public int Add(sButtonItem value)
{
return(List.Add(value));
}
public int IndexOf(sButtonItem value)
{
return(List.IndexOf(value));
}
public void Insert(int index, sButtonItem value)
{
List.Insert(index,value);
}
public void Remove(sButtonItem value)
{
List.Remove(value);
}
public bool Contains(sButtonItem value)
{
return(List.Contains(value));
}
}
// Button Creation goes here. The sButton Collection class handles the
creation of new items
// and instructs the sButtonItem class to create a new button based on
client provided properties
public class sButtonItem
{
public sButtonItem(string Text, string ButtonIMG)
{
this._Text=Text;
this._ButtonIMG=ButtonIMG;
}
protected string _Text;
public string text
{
get{return _Text;}
set{_Text=value;}
}
protected string _ButtonIMG;
public string buttonimg
{
get{return _ButtonIMG;}
set{_ButtonIMG=value;}
}
}
}

I keep getting Buttons() only takes 1 arguement when I instance it from the
web site.

Can someone tell me where I am going wrong here?
 
W

William F. Robertson, Jr.

Would you ask you question a different way? I am not sure what you have a
problem with.

bill


I am Sam said:
using System;
using System.Drawing;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using System.Web.UI.Design;
using System.Web.UI.Design.WebControls;
using System.Collections;

namespace FTextBox
{
/* Primary class that renders the control output.*/
[DefaultProperty("Text"), ToolboxData("<{0}:FTable
runat=server></{0}:FTable>")]

public class FTable: System.Web.UI.Control
{
// Renders the control and does not take any properties.
// Inherits the properties from other classes as follows:
// SButton - Renders the buttons which loops through the SButtonItem indix.
// SButton in tern inherits from SButtonItem.

protected override void Render(HtmlTextWriter writer)
{
if(base.Visible)
{
writer.WriteBeginTag("table");
writer.WriteAttribute("width","100%");
writer.WriteAttribute("height","100%");

/* Write Attributes following the above statement */

writer.Write(HtmlTextWriter.SelfClosingTagEnd);
writer.WriteFullBeginTag("tr");
ButtonOutput(writer);
writer.WriteEndTag("tr");
writer.WriteLine();
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.RenderBeginTag(HtmlTextWriterTag.Td);
TextArea(writer);
writer.RenderEndTag();
writer.RenderEndTag();
writer.WriteEndTag("Table");
}
}
private sButton _Buttons=new sButton();

public sButton Buttons()
{
return _Buttons;
}
protected void ButtonOutput(HtmlTextWriter writer)
{
foreach(sButtonItem pButton in Buttons())
{
writer.Write(pButton.buttonimg);
}
}
protected void TextArea(HtmlTextWriter writer)
{
writer.WriteBeginTag("textarea");
writer.WriteAttribute("cols","100%");
writer.WriteAttribute("rows","100%");
writer.Write(HtmlTextWriter.SelfClosingTagEnd);
writer.WriteEndTag("textarea");
}
}
// Pass the following properties to the sButton class:
// I need to iterate through the collection of sButton Items and build a
container cell.
// the iteration will then fill the Button output method.
// sButton class allows the user to create, add, index and remove new
buttons.

public class sButton : CollectionBase
{
public sButtonItem this[int index]
{
get{return((sButtonItem)List[index]);}
set{List[index]=value;}
}
public int Add(sButtonItem value)
{
return(List.Add(value));
}
public int IndexOf(sButtonItem value)
{
return(List.IndexOf(value));
}
public void Insert(int index, sButtonItem value)
{
List.Insert(index,value);
}
public void Remove(sButtonItem value)
{
List.Remove(value);
}
public bool Contains(sButtonItem value)
{
return(List.Contains(value));
}
}
// Button Creation goes here. The sButton Collection class handles the
creation of new items
// and instructs the sButtonItem class to create a new button based on
client provided properties
public class sButtonItem
{
public sButtonItem(string Text, string ButtonIMG)
{
this._Text=Text;
this._ButtonIMG=ButtonIMG;
}
protected string _Text;
public string text
{
get{return _Text;}
set{_Text=value;}
}
protected string _ButtonIMG;
public string buttonimg
{
get{return _ButtonIMG;}
set{_ButtonIMG=value;}
}
}
}

I keep getting Buttons() only takes 1 arguement when I instance it from the
web site.

Can someone tell me where I am going wrong here?
 

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,009
Latest member
GidgetGamb

Latest Threads

Top