c# - CSS3 Borders with Repeater 具有从数据库中取出的不同属性

标签 c# html asp.net css

我得到了我以前的答案,并按照我想要的方式得到了它,但我想要更多的东西我想要一点点扭曲:) 现在我用 http://www.w3schools.com/css/css3_borders.asphttp://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 位于右侧。如果可能,使用浅灰色/蓝色。

enter image description here

上一个问题: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/

相关文章:

asp.net - 在 ASP.NET MVC Core Controller 的构造函数中设置 ViewBag 属性

c# - 如何将 UTF-8 字符转换为 ASCII 以便在 URL 中使用?

c# - 如何将一个项目抛出的异常返回给另一个项目?

C#-SQL : How to execute a batch of StoredProcedure?

c# - 从 JSON 检索项目时获取 'Cannot cast Newtonsoft.Json.Linq.JObject to Newtonsoft.Json.Linq.JToken'

c# - 如何在紧凑的框架中翻译 DialogResult 中的按钮?

html - 设置 AngularJS HTML5 路由

javascript - HTML5异步文件上传,上传流总是无效

c# - 如何使用 C#.NET 合并在 MS Word 中创建的表格的单元格?

javascript - rtcPeerConnection 行为异常?