This project is read-only.

To div hide and show at each row in a ajax webgrid at selection of a checkbox in correspond row, in MVC..

Dec 23, 2013 at 11:11 AM
Hello Friends,

i am using ajax web grid in mvc razor. Also have check box at each row of web grid as column.
Now i want to show div at selected checkbox with in the row in web grid.

my code is as below:
 details.Column(header: "Reply", format: @<text>
      <input class="select" id="IsChecked" name="IsChecked" type="checkbox" value="@item.chatq_id" onclick="return VisitingChecked(IsChecked);" />,
<div id="divreply" style="display:none" > @Html.TextAreaFor(m => m.strChatQ_Reply, new { id = "txtChatQ_Reply", @class = "box" }) <a href="@Url.Action("adminreply", "adminreply", new { Id = @item.chatq_id, onclick="return Validate();"})">Reply</a>, @Html.HiddenFor(m=>m.hdstrChatQ_Reply, new{id="hdChatQ_Reply"}) </div>
now select/unselect of check box i want to show div or hide.
for this i used java script function:
function VisitingChecked(IsChecked) {
    if (document.getElementById("IsChecked").checked == true)
        document.getElementById("divreply").style.display = "block";
        document.getElementById("divreply").style.display = "none";
issue: it's showing div or hiding only 1st row with in webgrid.
for others row check box selection is not working.

Also i required to store the text box value which will enable after selecting the checkbox with in the row.

plz. help me in java script or where is required to do the changes plz suggest me.

Your effort will be really appreciable.

Dec 27, 2013 at 2:43 AM
I guess that you using not grid.mvc, and you need to address this question to another team.