我得到了我以前的答案,并按照我想要的方式得到了它,但我想要更多的东西我想要一点点扭曲:) 现在我用 http://www.w3schools.com/css/css3_borders.asp与http://www.w3schools.com/aspnet/aspnet_repeater.asp一起
我想要的是,当我从我的数据库中读取时,我有一个名为 answered with tinyint 1/2 if 1 its answered from and admin if 2 its from a user 的部分。我希望我的 css3 边框与 1 位于左侧,与 2 位于右侧。如果可能,使用浅灰色/蓝色。
上一个问题:asp.net foreach row in dataset make a balloon with text
我的代码是这样的
边.aspx
<asp:Repeater runat="server" ID="cdcatalog">
<ItemTemplate>
<div style="border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300px; border-radius: 25px;">
<asp:Table runat="server">
<asp:TableRow>
<asp:TableCell>
<p style="text-align:left; text-decoration: underline; font-weight: bold;"><%# Eval("TimeStamp")%></p>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<%# Eval("Tekst")%>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</ItemTemplate>
</asp:Repeater>
Side.aspx.cs
DBControl db = new DBControl();
String queryString2;
protected void Page_Load(object sender, EventArgs e)
{
queryString2 = "SELECT * FROM Samtaler WHERE TicketID=" + Session["ValgtTicket"].ToString() + "";
BindRepeater();
}
private void BindRepeater()
{
// Run the query and bind the resulting DataSet
// to the GridView control.
db.ConnOpenHelpdesk();
DataSet ds = db.GetData(queryString2);
cdcatalog.DataSource = ds;
cdcatalog.DataBind();
db.ConnCloseHelpdesk();
}
最佳答案
我必须使用 asp:panel 将其全部放在代码隐藏中
这是我用过的链接
http://www.ezineasp.net/post/ASP-Net-Repeater-dynamically-using-C-sharp-code.aspx
关于c# - CSS3 Borders with Repeater 具有从数据库中取出的不同属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25505505/