B
Banski
Hi,
Ive a annoying problem when creating Custom WebControl.
When i create this sample control in codebehind. It renders as:
<span id="testctrl"><input name="testctrl:testctrl"
id="testctrl_testctrl" type="text" value="TestValue" /></span>
Why does it render <span> tags? How can I create it without them?
Best regards
Banski
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing;
using System.Collections;
using System.Text;
namespace Conte.WebControls
{
/// <summary>
/// Summary description for TestControl.
/// </summary>
public class TestControl : System.Web.UI.WebControls.WebControl,
INamingContainer
{
public string Value
{
get { return htmlInputTxt.Value ; }
set { htmlInputTxt.Value = value; }
}
HtmlInputButton htmlInputBtn;
HtmlInputText htmlInputTxt;
protected override void CreateChildControls()
{
htmlInputTxt = new HtmlInputText();
htmlInputTxt.ID = base.ID;
htmlInputTxt.Name = base.ID;
htmlInputTxt.Value = "TestValue";
Controls.Add(htmlInputTxt);
}
}
}
Ive a annoying problem when creating Custom WebControl.
When i create this sample control in codebehind. It renders as:
<span id="testctrl"><input name="testctrl:testctrl"
id="testctrl_testctrl" type="text" value="TestValue" /></span>
Why does it render <span> tags? How can I create it without them?
Best regards
Banski
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing;
using System.Collections;
using System.Text;
namespace Conte.WebControls
{
/// <summary>
/// Summary description for TestControl.
/// </summary>
public class TestControl : System.Web.UI.WebControls.WebControl,
INamingContainer
{
public string Value
{
get { return htmlInputTxt.Value ; }
set { htmlInputTxt.Value = value; }
}
HtmlInputButton htmlInputBtn;
HtmlInputText htmlInputTxt;
protected override void CreateChildControls()
{
htmlInputTxt = new HtmlInputText();
htmlInputTxt.ID = base.ID;
htmlInputTxt.Name = base.ID;
htmlInputTxt.Value = "TestValue";
Controls.Add(htmlInputTxt);
}
}
}