2
Answers

Show the current div layer in JQuery

Ken H

Ken H

10y
989
1
Hello friend,
       How to display only the current div layer is clicked, instead of the whole show all.
 
My codes:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.9.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".panel").click(function () {
$(".flip").slideToggle("slow");
});
});
</script>
<style type="text/css">
div.panel,p.flip
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
width:200px;
}
ul.flip
{
height:60px;
display:none;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Literal ID="literal_1" runat="server"></asp:Literal>
</form>
</body>
</html>
cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e){
literal_1.Mode = LiteralMode.Encode;
literal_1.Mode = LiteralMode.Transform;
string strURL = "http://www.google.com";
string strURL2 = "http://www.csharpcorner.com";
string strURL3 = "http://www.codeproject.com";
literal_1.Text = @"<div class="+"panel"+">Module A<ul class="+"flip"+"><li><a href="+strURL+">Google</a></li>";
literal_1.Text += @"<li><a href=" + strURL3 + ">Code Project</a></li></ul></div><hr/>";
literal_1.Text += @"<div class=" + "panel" + ">Module B<ul class=" + "flip" + "><li><a href=" + strURL2 + ">C# Conver</a></li></ul></div><hr/>";
}
}
}
 
Thanks. 
 
 
Answers (2)
1
Midhun T P
NA 19.7k 281.2k 7y
Hi,
 
I think in the above code, the for loop will skip first row. Try giving value of "i" in for loop as -1;
 
for (int i = -1; i < dataGridView2.Rows.Count - 1; i++)
{
Accepted
0
Shafiqq Aziz
NA 45 809 7y
Midhun T P
Got it, thank you very much!
0
Shafiqq Aziz
NA 45 809 7y
Nilesh Sawardekar
 
Good suggestion but not working. Changed to 2 my header gone, change to 0 it throw an error (Exception on HRESULT: 0x800A03EC). Any other suggestion?
0
Nilesh Sawardekar
NA 1.4k 15.2k 7y
int cellRowIndex = 1;
 
change value of it and check.