-
[RESOLVED] datagrid with 2 columns that have different datatable rows
i want to make a datagrid with 2 columns and many rows
the columns i want to have databinding with a datatable
i want the 1 row 1 column of datagrid have data from 1 row of datatable
i want the 1 row 2 column of datagrid have data from 2 row of datatable
i want the 2 row 1 column of datagrid have data from 3 row of datatable
i want the 2 row 2 column of datagrid have data from 4 row of datatable
......
......
i use something like this
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'Text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:HyperLink>
</ItemTemplate >
</asp:TemplateColumn >
<Columns>
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'Text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:HyperLink>
</ItemTemplate >
</asp:TemplateColumn >
<Columns>
but i have two times the same in tha datagrid left and right
can anyone help me??
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
Have you thought about using a Repeater control instead?
Gary
-
Re: datagrid with 2 columns that have different datatable rows
no i havent thoout about that..
how can i do that with repeater??
-
Re: datagrid with 2 columns that have different datatable rows
You've got a datatable with x rows, but you're trying to arrange the displayed data in a different way.
Try a datalist as it's designed for this. You bind the datalist to your datatable. Make sure you specify
datalist1.RepeatColumns = 2
datalist1.RepeatDirection = RepeatDirection.Horizontal
Try it out.
-
Re: datagrid with 2 columns that have different datatable rows
What I was going to suggest was pretty similar to what Mendhak has suggested with the use of the DataList. Take control of the rendering of the contents to display it the way you want it.
If you are interested, you can find more information about the repeater here:
http://msdn.microsoft.com/en-us/libr...r_members.aspx
But thinking about it, DataList is probably the easiest solution.
http://msdn.microsoft.com/en-us/libr...t_members.aspx
Gary
-
Re: datagrid with 2 columns that have different datatable rows
thank you very much for the answer
i have done it with a different way retrieving the data from datatable because i didnt have seen the answer but i will try it again with the datalist
i thing it will be much more easier
-
Re: datagrid with 2 columns that have different datatable rows
another question that i have about grids is if it can be somehow to have some rows that have different content than the other rows
i want to have a last row in the grid that has a video
all other rows have content from a datatable
i want to put the video in the grid because if i dont do that the grid can come over the video or have a lot distance between them
am i thinking right??
any idea??
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
I am not sure that I follow what you are saying.
The positioning of a video, which I am assuming you are referring to an embedded object, shouldn't need to be placed into a GridView in order to position it correctly on the page, you should be able to handle it in isolation.
Can you post the ASPX markup that you are correctly using, along with a screen shot of the problem, or if a public facing website, can you provide a link?
Gary
-
1 Attachment(s)
Re: datagrid with 2 columns that have different datatable rows
ok i have attavhed the screen shot
i havent yet publish the site..
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
Ok, so this is purely an issue with the layout of the page.
Can you post the ASPX markup that you are using?
Gary
-
Re: datagrid with 2 columns that have different datatable rows
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="login" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 8.0 "/>
<meta name="CODE_LANGUAGE" content="Visual Basic 8.0"/>
<meta name="vs_defaultClientScript" content="vs_defaultClientScript"/>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"/>
<body bgcolor="#9900ff">
<form id="form1" runat="server">
<asp:DataGrid ID="DataGrid2" runat="server" AutoGenerateColumns="False" BorderColor="#000000"
BorderStyle="Double" BorderWidth="8px" CaptionAlign="Bottom" DataKeyField="text_id" ForeColor="#400040" ItemStyle-CssClass="WhiteSpaced"
PageSize="5" Style="left: 560px; position: absolute;top: 600px" Width="112px" Height="100px" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" ShowFooter="True" ShowHeader="False">
<PagerStyle BackColor="#FFFFC0" />
<ItemStyle BackColor="#FFFFC0" BorderColor="DarkRed" BorderStyle="Inset" BorderWidth="5px" CssClass="WhiteSpaced" Font-Size="Large"
Font-Strikeout="False" ForeColor="#400040" horizontalAlign="Left" VerticalAlign="Top" />
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'
Text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:HyperLink>
<asp:Label ID="Label7" runat="server" Font-Size="X-Small" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user") %>'></asp:Label>
<asp:Label ID="Label9" runat="server" Font-Size="XX-Small" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia") & "<br/>" %>'></asp:Label>
<asp:HyperLink ID="HyperLink5" runat="server" ImageUrl='<%# databinder.eval(container.dataitem,"image") %>'
NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'></asp:HyperLink>
<asp:Label ID="TextBox2" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno").ToString.Replace(chr(13), "<br />") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url2") %>' text='<%# databinder.eval(container.dataitem,"titlos2") %>' ></asp:HyperLink>
<asp:Label ID="Label7" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user2") %>' Font-Size="X-Small" ></asp:Label>
<asp:Label ID="Label9" runat="server" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia2") & "<br/>" %>' Font-Size="XX-Small"></asp:Label>
<asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url2") %>' ImageUrl='<%# databinder.eval(container.dataitem,"image2") %>'></asp:HyperLink>
<asp:label ID="TextBox2" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno2").ToString.Replace(chr(13), "<br />") %>'></asp:label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle BackColor="#C0C0FF" BorderColor="#8080FF" Font-Bold="True"
Height="0px" HorizontalAlign="Justify" VerticalAlign="Bottom" />
</asp:DataGrid>
<object width="512" height="350" >
<param name="movie" value="http://www.youtube.com/v/tVFSn8uKG6w"/>
<param name="allowscriptaccess" value="always"/>
<
<embed src="http://www.youtube.com/v/tVFSn8uKG6w" type="application/x-shockwave-flash" allowscriptaccess="always" width="512" height="350">
</embed>
</object>
</form>
this is note the whole code but i think it encludes what has importance
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
When you are posting code into the forum, can you remember to surround it in [code][/code] tags, it makes it so much easier to read!!
Can you wrap the object in a containing <div> element?
Gary
-
Re: datagrid with 2 columns that have different datatable rows
it already in a div but i didnt copy paste it(my mistake:))
any idea??
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
Paste the exact ASPX markup that you are using.
Gary
-
Re: datagrid with 2 columns that have different datatable rows
i think that you havenot understand what i mean
my problem is not to place the video in the page(that have we sold it yesterday)
my problem is that if the images of the datagrid have big height then comes the grid under the video
i search a way to automatically move the video if the grid comes over it
the whole code is to long to be readed..but if you want i will post it
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
You are right, I don't think I understand.
At the end of the day, the grid will occupy the amount of space that is required to show it content. After that, anything under the GridView will be rendered, there shouldn't be any overlap, unless you have put something in your markup to fix the video at a specific location.
That is why it would be good to see the exact code that you are using.
Gary
-
Re: datagrid with 2 columns that have different datatable rows
yes you are right i fix the video in a specific location
<div id="video1" style="position:absolute; left: 136px; top: 664px;">
<object width="512" height="350" >
<param name="movie" value="http://www.youtube.com/v/tVFSn8uKG6w"/>
<param name="allowscriptaccess" value="always"/>
<embed src="http://www.youtube.com/v/tVFSn8uKG6w" type="application/x-shockwave-flash" allowscriptaccess="always" width="512" height="350">
</embed>
</object>
but how else can i do it??
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
So why did you fix it in one location?
This is the problem with absolute positioning, you have a grid with stuff in it that you don't know how big it will get.
Take the absolute positioning off, the div should end up directly under the Grid. If this isn't what you want, explain exactly what you do want.
Gary
-
Re: datagrid with 2 columns that have different datatable rows
do you mean like this??
(that is the datagrid and the video in the same div)
Code:
<div id="grid kai video" style="position:absolute; left: 128px; top: 256px; height:1000px; width:225px" >
<asp:DataGrid ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#000000"
BorderStyle="Double" BorderWidth="8px" CaptionAlign="Bottom" DataKeyField="text_id" ForeColor="#400040" ItemStyle-CssClass="WhiteSpaced"
PageSize="5" Width="225px" Height="100px" CellSpacing="-1" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" ShowFooter="True" ShowHeader="False" >
<PagerStyle BackColor="#FFFFC0" />
<ItemStyle BackColor="#FFFFC0" BorderColor="DarkRed" BorderStyle="Inset" BorderWidth="5px" CssClass="WhiteSpaced" Font-Size="Large"
Font-Strikeout="False" ForeColor="#400040" horizontalAlign="Left" VerticalAlign="Top" Width="225px" />
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:LinkButton ID="linkbutton1" runat="server" BackColor="Transparent" BorderWidth="0px" PostBackUrl='<%# databinder.eval(container.dataitem,"url") %>' text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:LinkButton>
<asp:Label ID="Label7" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user") %>' Font-Size="X-Small" ></asp:Label>
<asp:Label ID="Label9" runat="server" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia") & "<br/>" %>' Font-Size="XX-Small"></asp:Label>
<asp:ImageButton ID="imagebutton1" runat="server" PostBackUrl='<%# databinder.eval(container.dataitem,"url") %>' ImageUrl='<%# databinder.eval(container.dataitem,"image") %>' ></asp:ImageButton>
<asp:label ID="Label10" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno").ToString.Replace(chr(13), "<br />") %>'></asp:label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle BackColor="#C0C0FF" BorderColor="#8080FF" Font-Bold="True"
Height="0px" HorizontalAlign="Justify" VerticalAlign="Bottom" />
</asp:DataGrid>
<object width="512" height="350" >
<param name="movie" value="http://www.youtube.com/v/tVFSn8uKG6w"/><param name="allowscriptaccess" value="always"/>
<embed src="http://www.youtube.com/v/tVFSn8uKG6w" type="application/x-shockwave-flash" allowscriptaccess="always" width="512" height="350">
</embed>
</object>
</div>
but again the video goes right of the grid and not down of the grid??
can you change the cod to have the video down of the grid??:):)
-
Re: datagrid with 2 columns that have different datatable rows
No, I mean two separate divs, and also, completely remove all absolute positioning.
Code:
<div>
//put your datagrid in here
</div>
<div>
//put your video in here
</div>
Gary
-
Re: datagrid with 2 columns that have different datatable rows
and where will all that be placed??
i have not only these elements in the page
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
That is why I was asking to see all your code, to see exactly what you have on the page. You would put the above within the form on your page.
It seems like you are struggling with the basics of laying out elements on your page, I think you might need to take a step back and practice laying out different elements on your page, and controlling your layout.
Gary
-
Re: datagrid with 2 columns that have different datatable rows
ok i write here the whole code
thanks anyway for your time my friend
(if you are bored with me i understand you have right,i know i have something to do with the basics but i want to go little fast..)
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="login" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 8.0 "/>
<meta name="CODE_LANGUAGE" content="Visual Basic 8.0"/>
<meta name="vs_defaultClientScript" content="vs_defaultClientScript"/>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"/>
<style type="text/css">
<!--
#musli {
position:absolute;
left:777px;
top:239px;
width:212px;
height:106px;
z-index:2;
}
#toumpa {
position:absolute;
left:233px;
top:164px;
width:638px;
height:127px;
z-index:1;
}
#Layer3 {
position:absolute;
left:268px;
top:105px;
width:597px;
height:169px;
z-index:3;
}
#Layer4 {
position:absolute;
left:401px;
top:376px;
width:487px;
height:120px;
z-index:4;
}
#vierinia {
position:absolute;
left:708px;
top:40px;
width:325px;
height:104px;
z-index:4;
}
#peja {
position:absolute;
left:148px;
top:40px;
width:150px;
height:187px;
z-index:5;
}
#teleytaiapost {
position:absolute;
left:229px;
top:345px;
width:312px;
height:229px;
z-index:6;
background-color: #00FFFF;
}
#protolayer {
position:absolute;
left:96px;
top:6px;
width:809px;
height:1367px;
z-index:0;
}
#dikefalos {
position:absolute;
left:862px;
top:38px;
width:223px;
height:153px;
z-index:6;
}
#kefalida {
position:absolute;
left:1px;
top:37px;
width:1633px;
height:104px;
z-index:0;
background-color: #000000;
}
-->
</style>
</head>
<body bgcolor="#9900ff">
<div id="vierinia"><img src="gallery/vie-koutsia.jpg" width="151" height="106" /> </div>
<div id="peja" style="left: 121px; top: 40px"><img src="gallery/pejasout.jpg" style="width: 128px; height: 106px" /></div>
<div id="protolayer" style="left: 120px; width: 1040px; top: 152px; background-color: white; height: 1560px;">
</div>
<div id="dikefalos" style="left: 864px; top: 40px"><img src="gallery/paok[1].jpg" width="194" style="height: 104px" /></div>
<div id="kefalida" style="left: 0px; top: 40px; height: 106px; width: 1256px;"></div>
<div id="musli" style="left: 594px; top: 56px"><img src="gallery/musli1.jpg" width="110" height="90" /></div>
<div id="toumpa" style="left: 248px; top: 40px"><img src="gallery/toumpa1.jpg" width="486" height="106" /></div>
<table style="position:absolute; left: 312px; width: 352px; top: 8px; height: 80px; z-index: 3;" id="TABLE1" >
<tr>
<td style="height: 16px; width: 184px;">
<div id="div8" style="width: 128px; background-color: #00ffff; height: 24px;" onmouseover="return prosta_onclick()" onclick="return paok()" > ÐñïóôáôåõìÝíåò</div>
</td>
<td style="height: 16px"><div id="div9" style="width: 131px; background-color: #00ffff; height: 24px;" lang="jscript" onclick="return paok()" onmouseover="return mel()" xml:lang="jscript" > Ãßíå ìÝëïò</div></td>
<td style="height: 16px"><div id="div10" style="width: 152px; background-color: #00ffff; height: 24px;" onmouseover="return pros()" onclick="return paok()"> ÐñïóùðéêÜ óôïé÷åßá</div></td>
</tr>
<tr>
<td style="height: 24px; width: 184px;" ><div id="div11" style=" visibility:hidden; width: 130px; height: 16px; background-color: #99ffff;" > <a id="thra" style="visibility:hidden;" href="secure_pages/Default10.aspx" > threads </a> </div></td>
<td style="height: 24px"><div id="div12" style="visibility:hidden; width: 131px; height: 24px; background-color: #00ffff;" > <a id="rega"
style="visibility:hidden;" href="register.aspx"
> register </a> </div></td>
<td style="height: 24px"><div id="div13" style="visibility:hidden;width: 152px; height: 24px; background-color: #00ffff;" onclick="return bio_onclick()" > <a id="bioa" style="visibility:hidden;" href="Default12.aspx" > Âéïãñáöéêü </a> </div></td>
</tr>
<tr>
<td style="width: 184px" ><div id="div14" style="visibility:hidden;width: 130px; background-color: #33ffff;" > <a id="downa" style="visibility:hidden;" href="secure_pages/Defaultt.aspx" > download </a> </div></td>
<td style="width: 131px" ></td>
<td style="width: 208px" ></td>
</tr>
</table>
<form id="form1" runat="server">
-
Re: datagrid with 2 columns that have different datatable rows
Code:
<asp:DataGrid ID="DataGrid2" runat="server" AutoGenerateColumns="False" BorderColor="#000000"
BorderStyle="Double" BorderWidth="8px" CaptionAlign="Bottom" DataKeyField="text_id" ForeColor="#400040" ItemStyle-CssClass="WhiteSpaced"
PageSize="5" Style="left: 680px; position: absolute;top: 744px" OnCancelCommand="ela" Width="112px" Height="100px" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" ShowFooter="True" ShowHeader="False">
<PagerStyle BackColor="#FFFFC0" />
<ItemStyle BackColor="#FFFFC0" BorderColor="DarkRed" BorderStyle="Inset" BorderWidth="5px" CssClass="WhiteSpaced" Font-Size="Large"
Font-Strikeout="False" ForeColor="#400040" horizontalAlign="Left" VerticalAlign="Top" />
<Columns>
<asp:TemplateColumn >
<ItemTemplate>
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'
Text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:HyperLink>
<asp:Label ID="Label7" runat="server" Font-Size="X-Small" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user") %>'></asp:Label>
<asp:Label ID="Label8" runat="server" Font-Size="XX-Small" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia") & "<br/>" %>'></asp:Label>
<asp:HyperLink ID="HyperLink3" runat="server" ImageUrl='<%# databinder.eval(container.dataitem,"image") %>'
NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>'></asp:HyperLink>
<asp:Label ID="TextBox2" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno").ToString.Replace(chr(13), "<br />") %>'></asp:Label>
<asp:Button ID="butou1" runat="server" CommandName="Cancel" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url2") %>' text='<%# databinder.eval(container.dataitem,"titlos2") %>' ></asp:HyperLink>
<asp:Label ID="Label9" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user2") %>' Font-Size="X-Small" ></asp:Label>
<asp:Label ID="Label10" runat="server" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia2") & "<br/>" %>' Font-Size="XX-Small"></asp:Label>
<asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url2") %>' ImageUrl='<%# databinder.eval(container.dataitem,"image2") %>'></asp:HyperLink>
<asp:label ID="TextBox3" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno2").ToString.Replace(chr(13), "<br />") %>'></asp:label>
<asp:Button ID="butou2" runat="server" CommandName="Cancel" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle BackColor="#C0C0FF" BorderColor="#8080FF" Font-Bold="True"
Height="0px" HorizontalAlign="Justify" VerticalAlign="Bottom" />
</asp:DataGrid>
<p align="center" id="login" style="left: 672px; width: 224px; position: absolute; top: 504px; height: 216px; background-color: #00FFFF;" name="login" >
<asp:Label ID="Label3" runat="server" Text="password:" style="position:absolute; left: 16px; top: 120px;">
</asp:Label>
<asp:Label ID="Label1" runat="server" Text="username:" style="position:absolute; left: 16px; top: 80px;">
</asp:Label>
<asp:Label ID="Label4" runat="server" Text="Εισάγετε το username και το password για δυνατότητα χρήσης του forum" style="position:absolute; left: 3px; top: 10px;" Width="224px"></asp:Label>
<asp:TextBox ID="tbox_username" runat="server" style="position:absolute; left: 96px; top: 80px;" Height="16px" Width="104px"></asp:TextBox>
<asp:TextBox ID="tbox_password" TextMode="Password" runat="server" style="position:absolute; left: 96px; top: 112px;" Width="104px"></asp:TextBox>
<asp:Button ID="btn_login" runat="server" Text="login" style="position:absolute; left: 16px; top: 152px;" Width="72px"/>
<asp:Button ID="btn_register" runat="server" Text="register" style="position:absolute; left: 112px; top: 152px;" Width="72px" />
<asp:Label ID="Label7" runat="server" Height="32px" Style="left: 8px; position: absolute;
top: 176px" Text="Είσαι πλέον αναγνωρισμένος χρήστης" Width="208px" Visible="False"></asp:Label>
<asp:Label ID="Label8" runat="server" Height="32px" Style="left: 8px; position: absolute;
top: 184px" Text="λάθος username ή password" Visible="False" Width="208px"></asp:Label>
</p>
<asp:HyperLink ID="HyperLink1" NavigateUrl="secure_pages/Default10.aspx" runat="server" style="position:absolute; left: 944px; top: 560px;" BackColor="Transparent" Width="240px" ForeColor="#C04000">Πατήστε εδώ για την προστατευμένη σελίδα</asp:HyperLink><asp:Label ID="Label2" runat="server" style="position:absolute; left: 776px; top: 16px;" BackColor="White" BorderColor="#FFE0C0" Font-Bold="True" Font-Italic="True" Width="192px"></asp:Label>
<asp:Label ID="Label5" runat="server" style="position:absolute; left: 976px; top: 16px;" BackColor="White" Font-Bold="True" Font-Italic="True" Width="240px"></asp:Label>
<asp:HyperLink ID="HyperLink4" runat="server" BackColor="#FFFF80" NavigateUrl="Default2.aspx"
Style="left: 1176px; position: absolute; top: 504px" Width="32px">flash</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/giatousadmin.aspx" Style="left: 1008px; position: absolute; top: 608px">A</asp:HyperLink>
<asp:Label ID="episkepteslabel" style="position:absolute; left: 1128px; top: 352px;" runat="server" Text="sinolo episkepton" Height="32px" Width="104px"></asp:Label>
<asp:Label ID="episkeptes" style="position:absolute; left: 1152px; top: 200px;" runat="server" Text="Label" Height="32px" Width="80px"></asp:Label>
<asp:Label ID="egegramenoilabel" style="position:absolute; left: 1136px; top: 304px;" runat="server" Text="egegramena meli" Height="32px" Width="104px"></asp:Label>
-
Re: datagrid with 2 columns that have different datatable rows
Code:
<asp:Label ID="egegramenoi" style="position:absolute; left: 1144px; top: 248px;" runat="server" Text="Label" Height="32px" Width="80px"></asp:Label>
<div id="grid kai video" style="position:absolute; left: 136px; top: 256px; height:1000px; width:225px; " >
<div >
<asp:DataGrid ID="GridView1" runat="server" AutoGenerateColumns="False" BorderColor="#000000"
BorderStyle="Double" BorderWidth="8px" CaptionAlign="Bottom" DataKeyField="text_id" ForeColor="#400040" ItemStyle-CssClass="WhiteSpaced"
PageSize="5" Width="225px" CellSpacing="-1" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Left" ShowFooter="True" ShowHeader="False" >
<PagerStyle BackColor="#FFFFC0" />
<ItemStyle BackColor="#FFFFC0" BorderColor="DarkRed" BorderStyle="Inset" BorderWidth="5px" CssClass="WhiteSpaced" Font-Size="Large"
Font-Strikeout="False" ForeColor="#400040" horizontalAlign="Left" VerticalAlign="Top" Width="225px" />
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:LinkButton ID="linkbutton1" runat="server" BackColor="Transparent" BorderWidth="0px" PostBackUrl='<%# databinder.eval(container.dataitem,"url") %>' text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:LinkButton>
<asp:Label ID="Label7" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"user") %>' Font-Size="X-Small" ></asp:Label>
<asp:Label ID="Label9" runat="server" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia") & "<br/>" %>' Font-Size="XX-Small"></asp:Label>
<asp:ImageButton ID="imagebutton1" runat="server" PostBackUrl='<%# databinder.eval(container.dataitem,"url") %>' ImageUrl='<%# databinder.eval(container.dataitem,"image") %>' ></asp:ImageButton>
<asp:label ID="Label10" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"text_captionkomeno").ToString.Replace(chr(13), "<br />") %>'></asp:label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle BackColor="#C0C0FF" BorderColor="#8080FF" Font-Bold="True"
Height="0px" HorizontalAlign="Justify" VerticalAlign="Bottom" />
</asp:DataGrid>
</div><br />
<div>
<br />
<br />
<object width="512" height="350" id="Object1" ><param name="movie" value="http://www.youtube.com/v/tVFSn8uKG6w"/><param name="allowscriptaccess" value="always"/>
<embed src="http://www.youtube.com/v/tVFSn8uKG6w" type="application/x-shockwave-flash" allowscriptaccess="always" width="512" height="350">
</embed>
</object>
</div>
</div>
<asp:Button ID="kataxorisefoto" runat="server" style="position:relative; left: 904px; top: 608px;" Text="kataxorise foto" />
<asp:Label ID="Label6" runat="server" style="position:absolute; left: 248px; top: 160px;" Text="mori poutanara xeftilismeni" Width="728px"></asp:Label>
<div id="Div1" style=" position:absolute; left: 672px; width: 224px; top: 192px; height: 304px; background-color: #00ffff;">
<asp:HyperLink ID="telpost1" NavigateUrl="secure_pages/0.aspx" style="position:absolute; left: 8px; top: 8px;" runat="server" Height="24px" Width="208px">[telpost1]</asp:HyperLink>
<asp:HyperLink ID="telpost2" NavigateUrl="secure_pages/1.aspx" style="position:absolute; left: 8px; top: 64px;" runat="server" Height="24px" Width="208px">[telpost2]</asp:HyperLink>
<asp:HyperLink ID="telpost3" NavigateUrl="secure_pages/2.aspx" style="position:absolute; left: 8px; top: 128px;" runat="server" Height="24px" Width="208px">[telpost3]</asp:HyperLink>
<asp:HyperLink ID="telpost4" NavigateUrl="secure_pages/3.aspx" style="position:absolute; left: 8px; top: 192px;" runat="server" Height="24px" Width="208px">[telpost4]</asp:HyperLink>
<asp:HyperLink ID="telpost5" NavigateUrl="secure_pages/4.aspx" style="position:absolute; left: 8px; top: 248px;" runat="server" Height="24px" Width="208px">[telpost5]</asp:HyperLink>
</div>
<asp:DataGrid ID="DataGrid1" runat="server"
AutoGenerateColumns="False" BorderColor="#000000" BorderStyle="Double" BorderWidth="8px"
CaptionAlign="Bottom" DataKeyField="text_id" ForeColor="#400040" ItemStyle-CssClass="WhiteSpaced"
Style="left: 904px; position: absolute;
top: 200px" UseAccessibleHeader="True" Width="248px" Height="1px">
<PagerStyle BackColor="#FFFFC0" />
<ItemStyle BackColor="#FFFFC0" BorderColor="DarkRed" BorderStyle="Inset" BorderWidth="5px"
CssClass="WhiteSpaced" Font-Size="Large" Font-Strikeout="False" ForeColor="#400040"
HorizontalAlign="Left" VerticalAlign="Top" />
<Columns>
<asp:TemplateColumn >
<ItemTemplate >
<asp:HyperLink ID="HyperLink6" runat="server" ImageUrl='<%# databinder.eval(container.dataitem,"image") %>' NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>' ></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn >
<ItemTemplate>
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl='<%# databinder.eval(container.dataitem,"url") %>' Text='<%# databinder.eval(container.dataitem,"titlos") %>'></asp:HyperLink>
<asp:Label ID="Label7" runat="server" Text='<%# "<br/>" & databinder.eval(container.dataitem,"site") %>' Font-Size="Small"></asp:Label>
<asp:Label ID="Label9" runat="server" Text='<%# " |" & databinder.eval(container.dataitem,"imerominia") & "<br/>" %>' Font-Size="Small" ></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle BackColor="#C0C0FF" BorderColor="#8080FF" Font-Bold="True" Font-Size="Large" Height="18px" HorizontalAlign="Justify" VerticalAlign="Bottom" />
</asp:DataGrid>
<asp:Timer ID="Timer1" runat="server" Interval="1000" >
</asp:Timer>
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
</form>
</body>
</html>
-
Re: datagrid with 2 columns that have different datatable rows
Hey,
Ok, I will need to take a look at this in detail, which I don't have enough time for just now, but I see in your CSS, that you are using a lot of absolute positioning. Is this through choice?
I would recommend that you don't use this approach, as you will run into more and more of these issues.
Gary
-
Re: datagrid with 2 columns that have different datatable rows
the solution was to put a table in the page and put all the things in columns of the table
so nothing goes over something else
-
Re: [RESOLVED] datagrid with 2 columns that have different datatable rows
The DIV way of doing this is to create your content with DIVs, and to place each 'column' of stuff in another container DIV. Look at this example:
http://www.456bereastreet.com/lab/de...slayout/2-col/
-
Re: [RESOLVED] datagrid with 2 columns that have different datatable rows
Bookmarked, really nice article!!