467,885 Members | 1,300 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 developers. It's quick & easy.

Table cells background

Hi,
Can anyone tell me how to change a table cells background color or
background image in runtime with C#.

Karl-Inge
Mar 7 '06 #1
  • viewed: 5441
Share:
10 Replies
You can use the cssClass attribute, e.g.

..TableCell1
{
background-image:url("images/Image1.gif");
}

and in your C# code:

TableCell td1= new TableCell();
td1.CssClass = "TableCell1";

//or you can add it without a CssClass like this:
td.Height = "100px";
td1.Width = "100px";
td1.Style.Add("background-image", "url('image1.gif')");
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,
Can anyone tell me how to change a table cells background color or
background image in runtime with C#.

Karl-Inge

Mar 7 '06 #2
Thanks Williams

Karl-Inge

"Phillip Williams" wrote:
You can use the cssClass attribute, e.g.

.TableCell1
{
background-image:url("images/Image1.gif");
}

and in your C# code:

TableCell td1= new TableCell();
td1.CssClass = "TableCell1";

//or you can add it without a CssClass like this:
td.Height = "100px";
td1.Width = "100px";
td1.Style.Add("background-image", "url('image1.gif')");
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,
Can anyone tell me how to change a table cells background color or
background image in runtime with C#.

Karl-Inge

Mar 8 '06 #3
Hi Phillips

Your suggestion help me in the right directions, but I have still problem.
I’m trying to make a tab style horizontal menu similar to that you use on top
of your web http://www.webswapp.com.

Do you have an example?

Karl-Inge
"Phillip Williams" wrote:
You can use the cssClass attribute, e.g.

.TableCell1
{
background-image:url("images/Image1.gif");
}

and in your C# code:

TableCell td1= new TableCell();
td1.CssClass = "TableCell1";

//or you can add it without a CssClass like this:
td.Height = "100px";
td1.Width = "100px";
td1.Style.Add("background-image", "url('image1.gif')");
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,
Can anyone tell me how to change a table cells background color or
background image in runtime with C#.

Karl-Inge

Mar 8 '06 #4
Hi Karl-Inge,

In displaying menu items on my website, I use a Button server control whose
cssClass is set with a background image that gives that impression of a Tab
(without the rectangular edges). The button has both the onmouseout and
onmouseover events changing the cssClass (which in turn displays a different
background image to the button).

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi Phillips

Your suggestion help me in the right directions, but I have still problem.
I’m trying to make a tab style horizontal menu similar to that you use on top
of your web http://www.webswapp.com.

Do you have an example?

Karl-Inge
"Phillip Williams" wrote:
You can use the cssClass attribute, e.g.

.TableCell1
{
background-image:url("images/Image1.gif");
}

and in your C# code:

TableCell td1= new TableCell();
td1.CssClass = "TableCell1";

//or you can add it without a CssClass like this:
td.Height = "100px";
td1.Width = "100px";
td1.Style.Add("background-image", "url('image1.gif')");
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,
Can anyone tell me how to change a table cells background color or
background image in runtime with C#.

Karl-Inge

Mar 8 '06 #5
Hi Phillip

Thanks for your help.

I can now change the buttons style with onmouseover and onmouseout.
My next problem is how I can reach a CSharp script when click the button.
Karl-Inge
"Phillip Williams" wrote:
Hi Karl-Inge,

In displaying menu items on my website, I use a Button server control whose
cssClass is set with a background image that gives that impression of a Tab
(without the rectangular edges). The button has both the onmouseout and
onmouseover events changing the cssClass (which in turn displays a different
background image to the button).

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi Phillips

Your suggestion help me in the right directions, but I have still problem.
I’m trying to make a tab style horizontal menu similar to that you use on top
of your web http://www.webswapp.com.

Do you have an example?

Karl-Inge
"Phillip Williams" wrote:
You can use the cssClass attribute, e.g.

.TableCell1
{
background-image:url("images/Image1.gif");
}

and in your C# code:

TableCell td1= new TableCell();
td1.CssClass = "TableCell1";

//or you can add it without a CssClass like this:
td.Height = "100px";
td1.Width = "100px";
td1.Style.Add("background-image", "url('image1.gif')");
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:

> Hi,
> Can anyone tell me how to change a table cells background color or
> background image in runtime with C#.
>
> Karl-Inge
>
>

Mar 8 '06 #6
Hi,

I found the solution. "onserverclick" trigger C# event

Karl-Inge

"Karl-Inge Reknes" wrote:
Hi Phillip

Thanks for your help.

I can now change the buttons style with onmouseover and onmouseout.
My next problem is how I can reach a CSharp script when click the button.
Karl-Inge
"Phillip Williams" wrote:
Hi Karl-Inge,

In displaying menu items on my website, I use a Button server control whose
cssClass is set with a background image that gives that impression of a Tab
(without the rectangular edges). The button has both the onmouseout and
onmouseover events changing the cssClass (which in turn displays a different
background image to the button).

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi Phillips

Your suggestion help me in the right directions, but I have still problem.
I’m trying to make a tab style horizontal menu similar to that you use on top
of your web http://www.webswapp.com.

Do you have an example?

Karl-Inge
"Phillip Williams" wrote:

> You can use the cssClass attribute, e.g.
>
> .TableCell1
> {
> background-image:url("images/Image1.gif");
> }
>
> and in your C# code:
>
> TableCell td1= new TableCell();
> td1.CssClass = "TableCell1";
>
> //or you can add it without a CssClass like this:
> td.Height = "100px";
> td1.Width = "100px";
> td1.Style.Add("background-image", "url('image1.gif')");
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Karl-Inge Reknes" wrote:
>
> > Hi,
> > Can anyone tell me how to change a table cells background color or
> > background image in runtime with C#.
> >
> > Karl-Inge
> >
> >

Mar 9 '06 #7
You must have used an HtmlInputButton <input type="button"> object. If you
had used a Button server control it would have equally worked with the
Button.Click event, e..g

<asp:Button OnClick="ServerFunction"
onmouseover="this.className='something';"
onmouseout="this.className='somethingelse';" Text="Menu1"
runat="sever"></asp:Button>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,

I found the solution. "onserverclick" trigger C# event

Karl-Inge

"Karl-Inge Reknes" wrote:
Hi Phillip

Thanks for your help.

I can now change the buttons style with onmouseover and onmouseout.
My next problem is how I can reach a CSharp script when click the button.
Karl-Inge
"Phillip Williams" wrote:
Hi Karl-Inge,

In displaying menu items on my website, I use a Button server control whose
cssClass is set with a background image that gives that impression of a Tab
(without the rectangular edges). The button has both the onmouseout and
onmouseover events changing the cssClass (which in turn displays a different
background image to the button).

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:

> Hi Phillips
>
> Your suggestion help me in the right directions, but I have still problem.
> I’m trying to make a tab style horizontal menu similar to that you use on top
> of your web http://www.webswapp.com.
>
> Do you have an example?
>
> Karl-Inge
>
>
> "Phillip Williams" wrote:
>
> > You can use the cssClass attribute, e.g.
> >
> > .TableCell1
> > {
> > background-image:url("images/Image1.gif");
> > }
> >
> > and in your C# code:
> >
> > TableCell td1= new TableCell();
> > td1.CssClass = "TableCell1";
> >
> > //or you can add it without a CssClass like this:
> > td.Height = "100px";
> > td1.Width = "100px";
> > td1.Style.Add("background-image", "url('image1.gif')");
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "Karl-Inge Reknes" wrote:
> >
> > > Hi,
> > > Can anyone tell me how to change a table cells background color or
> > > background image in runtime with C#.
> > >
> > > Karl-Inge
> > >
> > >

Mar 10 '06 #8
Thank you Phillip

Yes, I used HthmlInputButton with runat=server, and that work fin.

Your suggestion work, but IntelliSense don’t give me the choose
“onmouseover, onmouseout” and I cant find information in Visual studio 2005
documentation that asp:button support this events?

Is it some basic information I have missed?

Karl-Inge Reknes


"Phillip Williams" wrote:
You must have used an HtmlInputButton <input type="button"> object. If you
had used a Button server control it would have equally worked with the
Button.Click event, e..g

<asp:Button OnClick="ServerFunction"
onmouseover="this.className='something';"
onmouseout="this.className='somethingelse';" Text="Menu1"
runat="sever"></asp:Button>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,

I found the solution. "onserverclick" trigger C# event

Karl-Inge

"Karl-Inge Reknes" wrote:
Hi Phillip

Thanks for your help.

I can now change the buttons style with onmouseover and onmouseout.
My next problem is how I can reach a CSharp script when click the button.
Karl-Inge
"Phillip Williams" wrote:

> Hi Karl-Inge,
>
> In displaying menu items on my website, I use a Button server control whose
> cssClass is set with a background image that gives that impression of a Tab
> (without the rectangular edges). The button has both the onmouseout and
> onmouseover events changing the cssClass (which in turn displays a different
> background image to the button).
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Karl-Inge Reknes" wrote:
>
> > Hi Phillips
> >
> > Your suggestion help me in the right directions, but I have still problem.
> > I’m trying to make a tab style horizontal menu similar to that you use on top
> > of your web http://www.webswapp.com.
> >
> > Do you have an example?
> >
> > Karl-Inge
> >
> >
> > "Phillip Williams" wrote:
> >
> > > You can use the cssClass attribute, e.g.
> > >
> > > .TableCell1
> > > {
> > > background-image:url("images/Image1.gif");
> > > }
> > >
> > > and in your C# code:
> > >
> > > TableCell td1= new TableCell();
> > > td1.CssClass = "TableCell1";
> > >
> > > //or you can add it without a CssClass like this:
> > > td.Height = "100px";
> > > td1.Width = "100px";
> > > td1.Style.Add("background-image", "url('image1.gif')");
> > > --
> > > HTH,
> > > Phillip Williams
> > > http://www.societopia.net
> > > http://www.webswapp.com
> > >
> > >
> > > "Karl-Inge Reknes" wrote:
> > >
> > > > Hi,
> > > > Can anyone tell me how to change a table cells background color or
> > > > background image in runtime with C#.
> > > >
> > > > Karl-Inge
> > > >
> > > >

Mar 10 '06 #9
Those events are javascript. You'll have to write the event code yourself.

Karl-Inge Reknes wrote:
Thank you Phillip

Yes, I used HthmlInputButton with runat=server, and that work fin.

Your suggestion work, but IntelliSense don’t give me the choose
“onmouseover, onmouseout” and I cant find information in Visual studio 2005
documentation that asp:button support this events?

Is it some basic information I have missed?

Karl-Inge Reknes


"Phillip Williams" wrote:
You must have used an HtmlInputButton <input type="button"> object. If you
had used a Button server control it would have equally worked with the
Button.Click event, e..g

<asp:Button OnClick="ServerFunction"
onmouseover="this.className='something';"
onmouseout="this.className='somethingelse';" Text="Menu1"
runat="sever"></asp:Button>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,

I found the solution. "onserverclick" trigger C# event

Karl-Inge

"Karl-Inge Reknes" wrote:

Hi Phillip

Thanks for your help.

I can now change the buttons style with onmouseover and onmouseout.
My next problem is how I can reach a CSharp script when click the button.
Karl-Inge
"Phillip Williams" wrote:

> Hi Karl-Inge,
>
> In displaying menu items on my website, I use a Button server control whose
> cssClass is set with a background image that gives that impression of a Tab
> (without the rectangular edges). The button has both the onmouseout and
> onmouseover events changing the cssClass (which in turn displays a different
> background image to the button).
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Karl-Inge Reknes" wrote:
>
>> Hi Phillips
>>
>> Your suggestion help me in the right directions, but I have still problem.
>> I’m trying to make a tab style horizontal menu similar to that you use on top
>> of your web http://www.webswapp.com.
>>
>> Do you have an example?
>>
>> Karl-Inge
>>
>>
>> "Phillip Williams" wrote:
>>
>>> You can use the cssClass attribute, e.g.
>>>
>>> .TableCell1
>>> {
>>> background-image:url("images/Image1.gif");
>>> }
>>>
>>> and in your C# code:
>>>
>>> TableCell td1= new TableCell();
>>> td1.CssClass = "TableCell1";
>>>
>>> //or you can add it without a CssClass like this:
>>> td.Height = "100px";
>>> td1.Width = "100px";
>>> td1.Style.Add("background-image", "url('image1.gif')");
>>> --
>>> HTH,
>>> Phillip Williams
>>> http://www.societopia.net
>>> http://www.webswapp.com
>>>
>>>
>>> "Karl-Inge Reknes" wrote:
>>>
>>>> Hi,
>>>> Can anyone tell me how to change a table cells background color or
>>>> background image in runtime with C#.
>>>>
>>>> Karl-Inge
>>>>
>>>>

--
Ray Booysen
rj********@rjb.za.net
Mar 10 '06 #10
Hi Karl-Inge,

No, it is not exactly basic information that you missed; rather it is
programming knowledge that you would have acquired had you worked with DHTML
before the ASP.NET server controls had come along. :)

ASP.NET server controls are very excellent creatures in allowing programmers
powerful interfaces without having to learn all of the details of the HTML
objects that they render. The onmouseover and onmouseout attributes could
have been done in a more elegant manner without having the intellisense
complaining about them like this in the codebehind (e.g. during the Page
PreRender event handling):

Button1.Attributes.Add("onmouseover", "this.className='class1';")
Button2.Attributes.Add("onmouseout", "this.className='class2';")

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Thank you Phillip

Yes, I used HthmlInputButton with runat=server, and that work fin.

Your suggestion work, but IntelliSense don’t give me the choose
“onmouseover, onmouseout” and I cant find information in Visual studio 2005
documentation that asp:button support this events?

Is it some basic information I have missed?

Karl-Inge Reknes


"Phillip Williams" wrote:
You must have used an HtmlInputButton <input type="button"> object. If you
had used a Button server control it would have equally worked with the
Button.Click event, e..g

<asp:Button OnClick="ServerFunction"
onmouseover="this.className='something';"
onmouseout="this.className='somethingelse';" Text="Menu1"
runat="sever"></asp:Button>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Karl-Inge Reknes" wrote:
Hi,

I found the solution. "onserverclick" trigger C# event

Karl-Inge

"Karl-Inge Reknes" wrote:

> Hi Phillip
>
> Thanks for your help.
>
> I can now change the buttons style with onmouseover and onmouseout.
> My next problem is how I can reach a CSharp script when click the button.
>
>
> Karl-Inge
>
>
> "Phillip Williams" wrote:
>
> > Hi Karl-Inge,
> >
> > In displaying menu items on my website, I use a Button server control whose
> > cssClass is set with a background image that gives that impression of a Tab
> > (without the rectangular edges). The button has both the onmouseout and
> > onmouseover events changing the cssClass (which in turn displays a different
> > background image to the button).
> >
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> >
> >
> > "Karl-Inge Reknes" wrote:
> >
> > > Hi Phillips
> > >
> > > Your suggestion help me in the right directions, but I have still problem.
> > > I’m trying to make a tab style horizontal menu similar to that you use on top
> > > of your web http://www.webswapp.com.
> > >
> > > Do you have an example?
> > >
> > > Karl-Inge
> > >
> > >
> > > "Phillip Williams" wrote:
> > >
> > > > You can use the cssClass attribute, e.g.
> > > >
> > > > .TableCell1
> > > > {
> > > > background-image:url("images/Image1.gif");
> > > > }
> > > >
> > > > and in your C# code:
> > > >
> > > > TableCell td1= new TableCell();
> > > > td1.CssClass = "TableCell1";
> > > >
> > > > //or you can add it without a CssClass like this:
> > > > td.Height = "100px";
> > > > td1.Width = "100px";
> > > > td1.Style.Add("background-image", "url('image1.gif')");
> > > > --
> > > > HTH,
> > > > Phillip Williams
> > > > http://www.societopia.net
> > > > http://www.webswapp.com
> > > >
> > > >
> > > > "Karl-Inge Reknes" wrote:
> > > >
> > > > > Hi,
> > > > > Can anyone tell me how to change a table cells background color or
> > > > > background image in runtime with C#.
> > > > >
> > > > > Karl-Inge
> > > > >
> > > > >

Mar 11 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Johnny | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.