Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:34:21+00:00 2026-06-17T09:34:21+00:00

in my data list i have a (div) and it’s id is divpost and

  • 0

in my data list i have a (div) and it’s id is divpost and it’s visibility is false. now i like to find that in datalist_databound and if condition is ok visibility will be true.

so i have used below code, but i do not know how i have to find (divpost).

for finding lables or another controls i have no problem according to below code, but for div i do not know how?

 protected void DataList1_ItemDataBound
 (object sender, DataListItemEventArgs e)
{


  var x = (Guid)(DataList1.DataKeys[e.Item.ItemIndex]);
    Label labelstatus = (Label)e.Item.FindControl("lblstatus");
    Label labelcomment = (Label)e.Item.FindControl("lblcomment");
    BindLable(labelstatus,labelcomment, x);


    var q3 = (from s in _DataContext.tblSends


              where (s.DraftId == _Draftid) 

              select s.ToEmailId ).Distinct();


    if ((Guid)q3.SingleOrDefault() == (Guid)Membership.GetUser().ProviderUserKey)
    {
        divpostcomment.visible = true;
    }

aspx markup is like below:

<asp:DataList ID="DataList1" runat="server" DataKeyField="userid" 
    OnItemDataBound="DataList1_ItemDataBound" 
    >
    <SeparatorStyle BorderStyle="Dotted" />
    <ItemTemplate>
        <table class="style2">
            <tr>
                <td>

                   <asp:Label ID="Label5" runat="server" Text='<%# "comments from "+Eval("username") %>'></asp:Label>
                    <asp:Label ID="lblStatus" runat="server" Text=""></asp:Label>
                    <br />

                    <asp:Label ID="lblComment" runat="server" Text=""></asp:Label>

                    <div id="divPostComment" runat="server" visible="false">

                        <asp:TextBox ID="txtComment" runat="server"></asp:TextBox>
                        <asp:FileUpload ID="FileUpload1" runat="server" />
                        <asp:Button ID="btnUpload" runat="server" Text="Upload" />
                        <asp:Button ID="pstComment" runat="server" Text="Post Comment" />

                    </div>
                </td>
            </tr>
            <tr>
                <td>



                </td>
            </tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:34:21+00:00Added an answer on June 17, 2026 at 9:34 am

    Try something like this:

    Control theDiv = e.Item.FindControl("divPostComment");
    if (theDiv != null) theDiv.Visible = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of data in javascript that looks like this: [[152, 48,
I have a list that when a link is selected, the div's associated will
I have a list of data points (0.2, 0.8, 0.95) that I want to
I have a list of data that is a schedule. Each item has a
I have some C structures related to a 'list' data structure. They look like
I have a div with data-role=listview and data-filter=true, which filters my list of collapsible
I have list of divs with some data in there: <div style=border: 1px solid
I have the code below that makes a list of div's drag and droppable,
I have a list of images and respective text data that I display using
I have a list of data that I need to display in a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.