开发者

Repeater unable to show textbox

I have a repeater trying to get multiple data to display. which includes a few textboxes which will show the current setting. take note that this acts like a 'edit info' page for multiple images at once.

i also have problem displaying the images from the database.

To make it simple :

my .cs code:

            DataTable ChildImageDT = myImagesBAL.GetChildImageDT(userID, childID, display);
            var userList = new List<Images>();
            foreach (DataRow row in ChildImageDT.Rows)
            {
                var child = new Images()
                {
                                   DateTaken = DateTime.Parse(row["image_taken_dt"].ToString()),
                                   PlaceTaken = row["image_taken_loc"].ToString(),
                                   DetailedInfo = row["image_info"].ToString()
                };
                userList.Add(child);
            }

            Repeater1.DataSource = userList;
            Repeater1.DataBind();

my .aspx code

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
    <table class="content_background">
        <tr>
            <td width= "10%">Date Taken:</td>
            <td><asp:TextBox ID="txtName" Text="<%#Eval("DateTaken")%>" Visible="true" runat="server" Height="100px" Width="100px"></asp:TextBox></td>
        </tr>
        <tr>
            <td width= "10%" bgcolor=aqua>Place Taken:</td>
            <td bgcolor=blue ><asp:TextBox ID="txtPassword" Text="<%#Eval("PlaceTaken")%>" Visible=true runat="server" BackColor="White" Font-Size="Large" ForeColor="Fuchsia" Height=50px ></asp:TextBox></td>
        </tr>
        <tr>
            <td width= "10%">Detailed Info:</td>
            <td><asp:TextBox ID="TextBox1" Text="<%#Eval("DetailedInfo")%开发者_开发知识库>" Visible=true runat="server" ></asp:TextBox></td>
        </tr>
    </table>
</ItemTemplate>

my output as shown:

note: that the output is in the "text: " but the whole text box doesnt appear.

Repeater unable to show textbox


You might be getting a "The server tag is not well formed." error.

Just change your Eval code to single quotes instead of a double quote e.g.

Text="<%# Eval("DateTaken") %>"  // It's understood as string text

to

Text='<%# Eval("DateTaken") %>' // now understood as server side code.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜