Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Annoying span

Reply
Thread Tools

Annoying span

 
 
Banski
Guest
Posts: n/a
 
      09-02-2004
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);

}
}
}
 
Reply With Quote
 
 
 
 
Konrad Rotuski
Guest
Posts: n/a
 
      09-02-2004
you have to override RenderBeginTag and RenderEndTag of your WebControl

also have a look at TagKey and TagName properties

HTH
Konrad Rotuski

"Banski" <> wrote in message
news: om...
> 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);
>
> }
> }
> }



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stéphane Klein Python 2 03-30-2010 12:35 AM
Re: I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stefan Behnel Python 0 03-29-2010 08:14 PM
Can span include span? Fulio Open HTML 5 06-26-2009 10:24 PM
DataGrid (body only) contained in <span>...</span> tags Dan Bishop ASP .Net Datagrid Control 2 06-07-2004 04:00 PM
Enable drag and drop to the text between <span></span> Wang, Jay Javascript 5 05-25-2004 09:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57