I have not written a lick of ASP.Internet during my existence before week so go easy on me, please.

I've an ASP.Internet page that shows pictures from the database. I produce a SqlDataReader and bind the repeater for this readers. The page shows a table with three posts: a thumbnail from the pic (path in the database), the title from the camera the pic was taken with (in the database), along with a comment concerning the picture.

The comment is going to be null after i upload photos towards the database. I would like the table to show the comment whether it is available, or maybe the comment area is null within the database, display an ASP textbox and button for that user to go in a comment concerning the picture.

It works out this isn't nearly as simple as I figured it might be. Can anybody suggest in my experience:

A) an explicit test for identifying when the "comment" column of the row is null

B) how you can conditionally display either text, or perhaps a textbox/button combination (texbox getting an id in the "ID" column from the database)

In my opinion I've the abilities to create the button click handler to update the database using the comment... basically could possibly get it to show.

Thank you ahead of time, and that i promise to say no ASP.Internet projects later on!

Since you are inside a databinding context, you should use databinding expressions around the visible qualities of the placeholder (or, every other control for your matter).

<asp:PlaceHolder runat="server" visible='<%# Convert.IsDbNull( Eval("comment") )%>'>
  <asp:TextBox ID="txtNewComment"... />
  <asp:Button ... />
</asp:PlaceHolder>

Because of not null, just slap an exclaimation point infront from the "Convert", also it shows when it is not null.

For the clickhandler, since "sender" would be the button, you could perform a simple

((Button)sender).Parent.FindControl("txtNewComment")

And you've got your textbox.

You should use Alex's suggestion to show either the comment or even the textbox/button combo when the comment area consists of a NULL value within the database. I believe you will have to bind towards the 'OnItemCommand' to deal with button clicks inside the repeater.

Here's a good example.

<asp:Repeater ID="myRepeater" runat="server" OnItemCommand="myRepeater_ItemCommand">
    <HeaderTemplate>
        <table>
    </HeaderTemplate>
    <ItemTemplate>  		
        <tr>
            <td>
                <asp:Image ID="imgThumbNail" runat="server" ImageUrl='<%# Eval("path") %>' />
            </td>
            <td>
                <asp:Label ID="lblCamera" runat="server" Text='<%# Eval("camera") %>'></asp:Label>
            </td>
            <td>
                <asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible='<%# Convert.IsDBNull( Eval("comment") )%>'>
                    <asp:Button ID="btnAddComment" runat="server" CommandArgument='<%# Eval("id") %>' CommandName="AddComment" Text="Add Comment" />
                    <asp:TextBox ID="txtComment" runat="server" </asp:TextBox>          			
                </asp:PlaceHolder>  			
                <asp:PlaceHolder ID="PlaceHolder2" runat="server" Visible='<%# !Convert.IsDBNull(Eval("comment"))%>'>
                    <asp:Label ID="lblComment" runat="server" Text='<%# Eval("comment") %>'></asp:Label>
                </asp:PlaceHolder>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>

protected void myRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    if (e.CommandName == "AddComment")
    {
        TextBox txtComment = (TextBox)e.Item.FindControl("txtComment");
        int id = Convert.ToInt32(e.CommandArgument);
        // use the record id to update the comment in the database with the value contained in the txtComment.Text property here
    }
}