|
|
|
start date: Tue, 24 Jul 2007 23:04:49 +0800,
posted on: microsoft.public.dotnet.framework.aspnet.webcontrols
back
| Thread Index |
|
1
jiatiejun
|
|
2
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
|
derived custom controls from Button or ImageButton
I want write a custom controls (Button or ImageButton derived)
and want set the "name" tag to my custom value
use this.Attributes["name"] = "MyNameValue";
or writer.AddAttribute(HtmlTextWriterAttribute.Name, "MyNameValue");
asp.net add my "name" tag
but itself name tag still exists
result HTML code:
<input type="submit" name="MyButton1" value="" id="MyButton1"
name="MyNameValue" />
---------------------------^^^^^^^^^ Button base class
+^^^^^^^^^^^ I add name tag
-------------------------------------------------------------------+
how to remove Button base class name tag ?
thanks
Date:Tue, 24 Jul 2007 23:04:49 +0800
Author:
|
Re: derived custom controls from Button or ImageButton
Try this:
In the control's constructor, set this.Name = "MyNameValue";
You may also want to explore using the TagPrefix attribute and the
ToolboxData attribute.
Here's more info on those:
http://msdn2.microsoft.com/en-us/library/system.web.ui.tagprefixattribute(VS.71).aspx
http://msdn2.microsoft.com/en-us/library/system.web.ui.toolboxdataattribute(VS.71).aspx
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"jiatiejun" wrote in message
news:%23ISj9PgzHHA.4928@TK2MSFTNGP03.phx.gbl...
>I want write a custom controls (Button or ImageButton derived)
>
> and want set the "name" tag to my custom value
>
> use this.Attributes["name"] = "MyNameValue";
>
> or writer.AddAttribute(HtmlTextWriterAttribute.Name, "MyNameValue");
>
> asp.net add my "name" tag
>
> but itself name tag still exists
>
> result HTML code:
>
> <input type="submit" name="MyButton1" value="" id="MyButton1"
> name="MyNameValue" />
> ---------------------------^^^^^^^^^ Button base class +^^^^^^^^^^^ I add
> name tag
> -------------------------------------------------------------------+
>
> how to remove Button base class name tag ?
>
>
> thanks
>
>
>
Date:Wed, 25 Jul 2007 07:22:02 -0700
Author:
|
|
|