Monday, March 26, 2012

Set default Tag Prefix and CSS?

Hello,
I am creating a web server control derived from
datagrid for the first time. Now I would like to set the
prefix of my control by default to SK instead of CC1. Is
that possible? The other question is that my datagrid
should use a default stylesheet. I have set the cssclass
property of all items which I want to change. BUT I am not
setting the link tag in the head section to my css. I dont
want to do that. I would like to do that direclty in my
component. Is that possible?
ThanksAlternatingItemStyle
ItemStyle
HeaderStyle
footerstyle
if u set css for these four element, css will apply for u're componet. plz
see blow , I explained how we hve to use sample class...
<asp:datagrid id="dgActivity" runat="server" AllowPaging="True"
Class="DataGridStyle" Width="100%"
CellPadding="2" PageSize="30" AutoGenerateColumns="False" AllowSorting="True
">
<AlternatingItemStyle
CssClass="DataGridAlterItemStyle"></AlternatingItemStyle>
<ItemStyle CssClass="DataGridItemStyle"></ItemStyle>
<HeaderStyle CssClass="DataGridHeaderStyle"></HeaderStyle>
.DataGridStyle
{
border-color : White;
border-style : solid;
}
.DataGridStyle td
{
border-color : White;
border-style : solid;
}
.DataGridHeaderStyle
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:link
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:hover
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
.DataGridHeaderStyle a:visited
{
font-size : 8pt;
font-family : Verdana;
font-weight : bold;
vertical-align : middle;
text-align : center;
color:White;
text-align : left;
background-color : "#6487DC";
}
"SK" wrote:

> Hello,
> I am creating a web server control derived from
> datagrid for the first time. Now I would like to set the
> prefix of my control by default to SK instead of CC1. Is
> that possible? The other question is that my datagrid
> should use a default stylesheet. I have set the cssclass
> property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont
> want to do that. I would like to do that direclty in my
> component. Is that possible?
> Thanks
>
Hello SK,
Look at the [assembly:TagPrefix] attribute. You'll need to reference System.Web.UI,
if you're not already.
[assembly:TagPrefix("YourNamespace", "YourPrefix")]
Matt Berther
http://www.mattberther.com

> Hello,
> I am creating a web server control derived from datagrid for the
> first time. Now I would like to set the prefix of my control by
> default to SK instead of CC1. Is that possible? The other question is
> that my datagrid should use a default stylesheet. I have set the
> cssclass property of all items which I want to change. BUT I am not
> setting the link tag in the head section to my css. I dont want to do
> that. I would like to do that direclty in my component. Is that
> possible?
> Thanks
>

0 comments:

Post a Comment