Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Getting HTML style attribute in Custom WebControl

Reply
Thread Tools

Getting HTML style attribute in Custom WebControl

 
 
msnews.microsoft.com
Guest
Posts: n/a
 
      10-30-2003
This seems like it should be easy (and maybe it is) but I can't figure it
out.

I have a custom web control (derived from
System.Web.UI.WebControls.WebControl)
I'm in Grid Layout mode so at design time the HTML in the .aspx page looks
like this:

<cc2:CAUTreeView id="cautv" style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 224px" runat="server" Width="50px"></cc2:CAUTreeView>

In my override of Render I want to get the style attribute so I can output
the same positioning information so the control renders in the exact spot
that it was designed in. I can't find any way to get at this at run-time.

Any ideas?

</joel>


 
Reply With Quote
 
 
 
 
HD
Guest
Posts: n/a
 
      10-31-2003
try something like this

if(Style != null)
{
writer.write("<span style\"" + Style + "\">");
writer.write("Your display text");
writer.write("</span>"
}

hd

"msnews.microsoft.com" <> wrote in message
news:OX9%...
> This seems like it should be easy (and maybe it is) but I can't figure it
> out.
>
> I have a custom web control (derived from
> System.Web.UI.WebControls.WebControl)
> I'm in Grid Layout mode so at design time the HTML in the .aspx page looks
> like this:
>
> <cc2:CAUTreeView id="cautv" style="Z-INDEX: 101; LEFT: 16px; POSITION:
> absolute; TOP: 224px" runat="server" Width="50px"></cc2:CAUTreeView>
>
> In my override of Render I want to get the style attribute so I can output
> the same positioning information so the control renders in the exact spot
> that it was designed in. I can't find any way to get at this at run-time.
>
> Any ideas?
>
> </joel>
>
>



 
Reply With Quote
 
 
 
 
msnews.microsoft.com
Guest
Posts: n/a
 
      10-31-2003
Doh! I was doing that but in the constructor. The Style wasn't loaded yet!

As soon as I did it in my Render override it worked fine.

Thanks and sorry for the waste of time!

</joel>

"HD" <> wrote in message
news:...
> try something like this
>
> if(Style != null)
> {
> writer.write("<span style\"" + Style + "\">");
> writer.write("Your display text");
> writer.write("</span>"
> }
>
> hd
>
> "msnews.microsoft.com" <> wrote in message
> news:OX9%...
> > This seems like it should be easy (and maybe it is) but I can't figure

it
> > out.
> >
> > I have a custom web control (derived from
> > System.Web.UI.WebControls.WebControl)
> > I'm in Grid Layout mode so at design time the HTML in the .aspx page

looks
> > like this:
> >
> > <cc2:CAUTreeView id="cautv" style="Z-INDEX: 101; LEFT: 16px;

POSITION:
> > absolute; TOP: 224px" runat="server" Width="50px"></cc2:CAUTreeView>
> >
> > In my override of Render I want to get the style attribute so I can

output
> > the same positioning information so the control renders in the exact

spot
> > that it was designed in. I can't find any way to get at this at

run-time.
> >
> > Any ideas?
> >
> > </joel>
> >
> >

>
>



 
Reply With Quote
 
olivier@kakoo.net
Guest
Posts: n/a
 
      11-03-2003
Instead of overriding the Render method, you may want to
override the RenderContents method.

Olivier
>-----Original Message-----
>try something like this
>
>if(Style != null)
>{
> writer.write("<span style\"" + Style + "\">");
> writer.write("Your display text");
> writer.write("</span>"
>}
>
>hd
>
>"msnews.microsoft.com" <> wrote in

message
>news:OX9%...
>> This seems like it should be easy (and maybe it is)

but I can't figure it
>> out.
>>
>> I have a custom web control (derived from
>> System.Web.UI.WebControls.WebControl)
>> I'm in Grid Layout mode so at design time the HTML in

the .aspx page looks
>> like this:
>>
>> <cc2:CAUTreeView id="cautv" style="Z-INDEX: 101;

LEFT: 16px; POSITION:
>> absolute; TOP: 224px" runat="server"

Width="50px"></cc2:CAUTreeView>
>>
>> In my override of Render I want to get the style

attribute so I can output
>> the same positioning information so the control

renders in the exact spot
>> that it was designed in. I can't find any way to get

at this at run-time.
>>
>> Any ideas?
>>
>> </joel>
>>
>>

>
>
>.
>

 
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
Custom webcontrol that references another webcontrol Fabricio ASP .Net Building Controls 0 09-21-2005 02:55 AM
Custom WebControl, custom property list Curt_C [MVP] ASP .Net Web Controls 0 09-01-2005 04:09 PM
Trapping an Exception ocurring in a Webcontrol at the Page or parent WebControl level. ASP .Net 2 01-31-2005 06:34 PM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
absolutePositioning attribute of Custom webcontrol Alessandro Zifiglio ASP .Net Building Controls 3 11-28-2003 09:09 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