Click here to Skip to main content
15,914,780 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display the datalist at 'top:200px' and 'left:300px;' in the following code. I could not find 'style' for datalist. How to make the datalist to appear at desired location.

<asp:DataList ID="DataList1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal" >

Thanks
Posted
Updated 11-Nov-13 22:20pm
v2

1 solution

use css
CSS
margin-top:200px;

and
CSS
margin-left:300px;

or but that DataList into a div
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 12-Nov-13 4:35am    
I tried like this.Not working.
<style type="text/css">
.myclass
{
margin-top:200px;
margin-right:300px;
}

</style>


<asp:DataList ID="DataList1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal" ItemStyle-CssClass= "myclass">
Vishal Pand3y 12-Nov-13 4:41am    
put that DataList into a div and apply a class in div
Vishal Pand3y 12-Nov-13 4:45am    
if you are still facing Problem post your complete code of aspx page
S.Rajendran from Coimbatore 12-Nov-13 4:57am    
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.myclass
{
margin-top:200px;
margin-right:300px;
}

</style>
</head>
<body>


<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server" RepeatColumns="2" RepeatDirection="Horizontal" ItemStyle-CssClass= "myclass">


<itemtemplate>
<table id="Table1" cellpadding="1" cellspacing="1" visible ="true">
<tr>
<td width="140px">
<p align="left">
Product ID:
<asp:Label ID="lblEmpCode" runat ="server" CssClass="LabelStyle"
Text= '<%#DataBinder.Eval(Container.DataItem, "product_id")%>'>

</p>
</td>
</tr>
</table>
<table id="Table2" style=" margin-top:-23px" cellpadding="1" cellspacing="1" visible ="true">
<tr>
<td>
<td style="left:0px"width="200px">
<p align="left">
Product Name:
<asp:Label ID="lblEmpName" runat = "server" CssClass="LabelStyle"
Text=' <%# DataBinder.Eval(Container.DataItem, "product_name")%>'>

</p>
</td>
</tr>
</table>
<table id="Table3" cellpadding="1" cellspacing="1" visible ="true">
<tr>
<td width="100px">
<p align="left">
<img src= '<%#DataBinder.Eval(Container.DataItem,"picture_path") %>'
style="height:100px;width:100px;border:1px solid gray;"/>
</td>
</p>
</td>

</tr>

</table>


</div>
</form>
</body>
</html>
Vishal Pand3y 12-Nov-13 5:04am    
@rajendra when i am copying your code in on my system there are too many errors so firstly i have to solve those problem or You solve these and then post the code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900