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 7789357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:16:27+00:00 2026-06-01T21:16:27+00:00

<%var i=1;%> <%foreach (var commentitem in item.commentsModelList) { <table border=0 class=commentbox> <tr> <td> <%:

  • 0
<%var i=1;%>
<%foreach (var commentitem in item.commentsModelList)
   { 
    <table border="0"  class="commentbox">
     <tr>
        <td>
           <%: Html.DisplayFor(modelItem => commentitem.CommentClob)%>
        </td>

     </tr>
     <tr>
        <%var rid = "reply" + i;%>
        <td>  <input id="<%:rid %>" type="button" value="reply"/>
     </td>
       <td>

      <%--addded--%>
        <div id="<%:rboxid %>">
            <input id="Text1" type="text" />
            <input id="postreply" type="button" value="postreply" />

        </div>
    </td>

     </tr>
  </table>
<% i++;}%>

I have the following query

1.
I want to display alert boxes when different hyperlink with different reply id is clicked.

Edited

2.
i want a to hide these div on page load and show div with id replybox1 when link with id reply1 is clicked and same for other divs

3.Is there any way to create div dymaically and performing the same functionality

  • 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-01T21:16:29+00:00Added an answer on June 1, 2026 at 9:16 pm

    To get an alert of the id when clicking on the input button, you can use this script. ( Assuming you have jQuery available in your page)

       $(function(){
          $(".commentbox input[type='button']").click(function(){
            var id=$(this).attr("id");
            alert(id);
          });
        });
    

    As Hasan already mentioned. you should probably use the comentItemId instead of using the i variable

    EDIT As per the update in question, This script will hide all divs in the page load and show only those div with id replybox1 when input with reply1 being clicked.

       $(function(){
          $(".commentbox div").hide();
          $(".commentbox input[type='button']").click(function(){
            var id=$(this).attr("id");
            var replyBoxId=id.substring(5);
            $("#replybox"+replyBoxId).show();
          });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table like: @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem
Why in the following Razor markup @foreach (var item in Model) { <tr> <td>@Html.DisplayFor(modelItem
Hi I have some code like: foreach (var item in Model) { <div> @Html.DisplayFor(modelItem
I have this html @foreach (var item in Model.Options) { <input type=checkbox checked=checked name=selectedObjects
Hi I have a ModelBinded View foreach (var Model in Model) { @Html.RadioButtonFor(modelItem =>
I have these table rows that have checkboxes: @foreach (var item in Model) {
I have the following code @foreach (var item in Model.Defaults) { <tr class=CertainCategory> <td>
Imagine that during a foreach(var item in enumerable) The enumerable items change. It will
This is My View: @foreach(var action in Model.Category.Actions) { <div class=action style=margin-right: 30px;> <input
I think I'm having boxing issues foreach(var p in item.GetType().GetProperties(). Where(p => p.GetValue(original, null)

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.