473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

adding table inside itemtemplate

hi all,

I added a html table with 2 rows inside the itemtemplate of my gridview.
It works ok, but the table border never touches the border of my gridview
cell.

How should I do if I want the internal table and my grid cell share the same
border, so noone realizes that there is a table inside my cell?

TIA
-E
Jan 9 '06 #1
6 6782
Edge,

By default, your datagrid will generate cells with padding - therefore your
inside table's border appears separately. Create a class for td that has no
padding and ensure that your ItemTemplate CssClass is set to it. Something
like:

<style>td.noPad{padding:0px}</style>
<asp:DataGrid ...>
<ItemTemplate CssClass="noPad" ..
</asp:DataGrid>

Unfortunately I do not have an ability to test it, but it is very likely to
fix your problem.

"Edge" wrote:
hi all,

I added a html table with 2 rows inside the itemtemplate of my gridview.
It works ok, but the table border never touches the border of my gridview
cell.

How should I do if I want the internal table and my grid cell share the same
border, so noone realizes that there is a table inside my cell?

TIA
-E

Jan 9 '06 #2
hi Sergey,
I just tried this but it did not work

-E
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:EE**********************************@microsof t.com...
Edge,

By default, your datagrid will generate cells with padding - therefore
your
inside table's border appears separately. Create a class for td that has
no
padding and ensure that your ItemTemplate CssClass is set to it. Something
like:

<style>td.noPad{padding:0px}</style>
<asp:DataGrid ...>
<ItemTemplate CssClass="noPad" ..
</asp:DataGrid>

Unfortunately I do not have an ability to test it, but it is very likely
to
fix your problem.

"Edge" wrote:
hi all,

I added a html table with 2 rows inside the itemtemplate of my gridview.
It works ok, but the table border never touches the border of my gridview
cell.

How should I do if I want the internal table and my grid cell share the
same
border, so noone realizes that there is a table inside my cell?

TIA
-E

Jan 9 '06 #3
Could you post some code, say create a sample page that demonstrates your
problem - I will look into it - it seems to me as css task rather than
anything else - could be some other styles just cascade through ...
"Edge" wrote:
hi Sergey,
I just tried this but it did not work

-E
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:EE**********************************@microsof t.com...
Edge,

By default, your datagrid will generate cells with padding - therefore
your
inside table's border appears separately. Create a class for td that has
no
padding and ensure that your ItemTemplate CssClass is set to it. Something
like:

<style>td.noPad{padding:0px}</style>
<asp:DataGrid ...>
<ItemTemplate CssClass="noPad" ..
</asp:DataGrid>

Unfortunately I do not have an ability to test it, but it is very likely
to
fix your problem.

"Edge" wrote:
hi all,

I added a html table with 2 rows inside the itemtemplate of my gridview.
It works ok, but the table border never touches the border of my gridview
cell.

How should I do if I want the internal table and my grid cell share the
same
border, so noone realizes that there is a table inside my cell?

TIA
-E


Jan 9 '06 #4
hi,
here it is the gridview and its css:

<asp:GridView ID="dgResults" runat="server" AutoGenerateColumns="False"
CssClass="GridTextCenter"
HeaderStyle-CssClass="GridHeaderCenter" Width="100%"
RowStyle-VerticalAlign="Top"
Visible="false" OnRowDataBound="dgResults_RowDataBound">
<Columns>
<asp:TemplateField HeaderStyle-BorderColor="black"
ItemStyle-BorderColor="black">
<HeaderTemplate>
No.
</HeaderTemplate>
<ItemTemplate>
<table><tr><td colspan=2><%# Eval("Row") %></td>
<tr><td>value a</td><td>value b</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
....

..GridTextCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
color: #000000;
text-decoration: none;
line-height: 1.5;
text-align:center;
background-color:White;
border-color:Black;
}

..GridHeaderCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: black;
line-height: 2;
text-decoration: none;
background-color:#87cefa ;
text-align:center;

}

"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:49**********************************@microsof t.com...
Could you post some code, say create a sample page that demonstrates your
problem - I will look into it - it seems to me as css task rather than
anything else - could be some other styles just cascade through ...
"Edge" wrote:
hi Sergey,
I just tried this but it did not work

-E
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com>
wrote
in message news:EE**********************************@microsof t.com...
> Edge,
>
> By default, your datagrid will generate cells with padding - therefore
> your
> inside table's border appears separately. Create a class for td that
> has
> no
> padding and ensure that your ItemTemplate CssClass is set to it.
> Something
> like:
>
> <style>td.noPad{padding:0px}</style>
> <asp:DataGrid ...>
> <ItemTemplate CssClass="noPad" ..
> </asp:DataGrid>
>
> Unfortunately I do not have an ability to test it, but it is very
> likely
> to
> fix your problem.
>
> "Edge" wrote:
>
>> hi all,
>>
>> I added a html table with 2 rows inside the itemtemplate of my
>> gridview.
>> It works ok, but the table border never touches the border of my
>> gridview
>> cell.
>>
>> How should I do if I want the internal table and my grid cell share
>> the
>> same
>> border, so noone realizes that there is a table inside my cell?
>>
>> TIA
>> -E
>>
>>
>>


Jan 11 '06 #5
Try the following:

<style>.inTable{height:100%;width:100%;border:blac k 0px solid;}
td.noPad{padding:0px}</style>
<asp:DataGrid ...>
....
<asp:TemplateField HeaderStyle-BorderColor="black"
ItemStyle-CssClass="noPad">
<HeaderTemplate>
No.
</HeaderTemplate>
<ItemTemplate>
<table class="inTable"><tr><td colspan=2><%# Eval("Row") %></td>
<tr><td>value a</td><td>value b</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
</asp:DataGrid>

I think that at least two things are happening: your ItemStyle uses 1px as
default padding, and because internal table is not stretched - it is
positioned at the center according to your stylesheet.
"Edge" wrote:
hi,
here it is the gridview and its css:

<asp:GridView ID="dgResults" runat="server" AutoGenerateColumns="False"
CssClass="GridTextCenter"
HeaderStyle-CssClass="GridHeaderCenter" Width="100%"
RowStyle-VerticalAlign="Top"
Visible="false" OnRowDataBound="dgResults_RowDataBound">
<Columns>
<asp:TemplateField HeaderStyle-BorderColor="black"
ItemStyle-BorderColor="black">
<HeaderTemplate>
No.
</HeaderTemplate>
<ItemTemplate>
<table><tr><td colspan=2><%# Eval("Row") %></td>
<tr><td>value a</td><td>value b</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
....

..GridTextCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
color: #000000;
text-decoration: none;
line-height: 1.5;
text-align:center;
background-color:White;
border-color:Black;
}

..GridHeaderCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: black;
line-height: 2;
text-decoration: none;
background-color:#87cefa ;
text-align:center;

}

"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:49**********************************@microsof t.com...
Could you post some code, say create a sample page that demonstrates your
problem - I will look into it - it seems to me as css task rather than
anything else - could be some other styles just cascade through ...
"Edge" wrote:
hi Sergey,
I just tried this but it did not work

-E
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com>
wrote
in message news:EE**********************************@microsof t.com...
> Edge,
>
> By default, your datagrid will generate cells with padding - therefore
> your
> inside table's border appears separately. Create a class for td that
> has
> no
> padding and ensure that your ItemTemplate CssClass is set to it.
> Something
> like:
>
> <style>td.noPad{padding:0px}</style>
> <asp:DataGrid ...>
> <ItemTemplate CssClass="noPad" ..
> </asp:DataGrid>
>
> Unfortunately I do not have an ability to test it, but it is very
> likely
> to
> fix your problem.
>
> "Edge" wrote:
>
>> hi all,
>>
>> I added a html table with 2 rows inside the itemtemplate of my
>> gridview.
>> It works ok, but the table border never touches the border of my
>> gridview
>> cell.
>>
>> How should I do if I want the internal table and my grid cell share
>> the
>> same
>> border, so noone realizes that there is a table inside my cell?
>>
>> TIA
>> -E
>>
>>
>>


Jan 12 '06 #6
yep...worked very well :)
Thanks a lot
Edge
"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com> wrote
in message news:5C**********************************@microsof t.com...
Try the following:

<style>.inTable{height:100%;width:100%;border:blac k 0px solid;}
td.noPad{padding:0px}</style>
<asp:DataGrid ...>
...
<asp:TemplateField HeaderStyle-BorderColor="black"
ItemStyle-CssClass="noPad">
<HeaderTemplate>
No.
</HeaderTemplate>
<ItemTemplate>
<table class="inTable"><tr><td colspan=2><%# Eval("Row") %></td>
<tr><td>value a</td><td>value b</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
</asp:DataGrid>

I think that at least two things are happening: your ItemStyle uses 1px as
default padding, and because internal table is not stretched - it is
positioned at the center according to your stylesheet.
"Edge" wrote:
hi,
here it is the gridview and its css:

<asp:GridView ID="dgResults" runat="server" AutoGenerateColumns="False"
CssClass="GridTextCenter"
HeaderStyle-CssClass="GridHeaderCenter" Width="100%"
RowStyle-VerticalAlign="Top"
Visible="false" OnRowDataBound="dgResults_RowDataBound">
<Columns>
<asp:TemplateField HeaderStyle-BorderColor="black"
ItemStyle-BorderColor="black">
<HeaderTemplate>
No.
</HeaderTemplate>
<ItemTemplate>
<table><tr><td colspan=2><%# Eval("Row") %></td>
<tr><td>value a</td><td>value b</td></tr></table>
</ItemTemplate>
</asp:TemplateField>
....

..GridTextCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
color: #000000;
text-decoration: none;
line-height: 1.5;
text-align:center;
background-color:White;
border-color:Black;
}

..GridHeaderCenter
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: black;
line-height: 2;
text-decoration: none;
background-color:#87cefa ;
text-align:center;

}

"Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com>
wrote
in message news:49**********************************@microsof t.com...
> Could you post some code, say create a sample page that demonstrates
> your
> problem - I will look into it - it seems to me as css task rather than
> anything else - could be some other styles just cascade through ...
>
>
> "Edge" wrote:
>
>> hi Sergey,
>> I just tried this but it did not work
>>
>> -E
>>
>>
>> "Sergey Poberezovskiy" <Se*****************@discussions.microsoft.com>
>> wrote
>> in message news:EE**********************************@microsof t.com...
>> > Edge,
>> >
>> > By default, your datagrid will generate cells with padding -
>> > therefore
>> > your
>> > inside table's border appears separately. Create a class for td that
>> > has
>> > no
>> > padding and ensure that your ItemTemplate CssClass is set to it.
>> > Something
>> > like:
>> >
>> > <style>td.noPad{padding:0px}</style>
>> > <asp:DataGrid ...>
>> > <ItemTemplate CssClass="noPad" ..
>> > </asp:DataGrid>
>> >
>> > Unfortunately I do not have an ability to test it, but it is very
>> > likely
>> > to
>> > fix your problem.
>> >
>> > "Edge" wrote:
>> >
>> >> hi all,
>> >>
>> >> I added a html table with 2 rows inside the itemtemplate of my
>> >> gridview.
>> >> It works ok, but the table border never touches the border of my
>> >> gridview
>> >> cell.
>> >>
>> >> How should I do if I want the internal table and my grid cell share
>> >> the
>> >> same
>> >> border, so noone realizes that there is a table inside my cell?
>> >>
>> >> TIA
>> >> -E
>> >>
>> >>
>> >>
>>
>>
>>


Jan 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
0
by: Dave | last post by:
Hi , I have the following where I need to append a string variable inside a hyperlink template, inside a datalist. The variable 'categoryList' is the culprit. No matter where this variable is...
0
by: mehul | last post by:
CheckBox template always evaluate to False even if checked in a DataGrid hosted inside a TabStrip in ASP.NET Hi, I am trying to develop an ASP.NET application. I am using TabStrip (which is...
6
by: simon | last post by:
I have <asp:repeater> with Item template: <ItemTemplate> <%# writeLine(DataBinder.Eval(Container.DataItem, "danIme"),DataBinder.Eval(Container.DataItem, "timeStart"))%> </ItemTemplate> In my...
1
by: Bennett Haselton | last post by:
If I have this code for repeater, it gives a compilation error saying "The type or namespace name 'MyValue2' could not be found": <asp:Repeater id="MyList" runat="server"> <ItemTemplate>...
3
by: Andre | last post by:
Hi, I have a <ItemTemplate> with a HTML Table inside, "id=commercial" who display Ads on our site. But for each Store, i have to put a different CSS Class name to my Table, but all the table...
3
by: Raja | last post by:
I have a simple question, I have a datagrid and inside the grid, i have List box. I am able to render the page with the datagrid and the lisbox values. Now, my question is how to trap the server...
3
by: mj.redfox.mj | last post by:
Hi I'm fairly new to ASP.NET and realise I'm probably asking a very straightforward question, sorry about that but I'd be grateful if someone could possibly help out - I'm sure the answer will...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.