Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > derived custom controls from Button or ImageButton

Reply
Thread Tools

derived custom controls from Button or ImageButton

 
 
jiatiejun
Guest
Posts: n/a
 
      07-24-2007
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



 
Reply With Quote
 
 
 
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      07-25-2007
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/lib...te(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...te(VS.71).aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"jiatiejun" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>
>
>


 
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
Derived Structure in Derived Class?? David C++ 3 01-29-2008 07:38 AM
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 01:44 PM
Derived::Derived(const Base&) developereo@hotmail.com C++ 4 05-23-2007 09:32 AM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 12:07 AM



Advertisments