Click here to Skip to main content
15,915,019 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use repeater control in my project but the problem is i am showing some data from database and some div field in panel but the problem i faced that my data is coming fine but my div repeat that is also fine but my problem is in div i have button and that button click my panel is hide but here that's not working due to my panel id.it is increment by panel_1, pnel_2 accordingly . what should i do ?

ASP.NET
<%@ Page Language="C#" CodeBehind="Server2.aspx.cs" Inherits="Templates.Server2" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Server - FindAllControls (Extension Method)</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="idScriptManager" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="idUpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="idShowPrice" EventName="CheckedChanged" />
</Triggers>
<ContentTemplate>
<asp:CheckBox ID="idShowPrice" runat="server" Text="Show Price" Checked="true" AutoPostBack="true" />
<asp:DataList ID="idBookList" runat="server" DataSourceID="idBookData" CellPadding="4" CellSpacing="4">
<ItemStyle BorderWidth="1" />
<ItemTemplate>
<asp:Panel runat="server" ID="idGenre"><%# XPath("genre") %></asp:Panel>
<asp:Panel runat="server" ID="idTitle"><%# XPath("title") %></asp:Panel>
<asp:Panel runat="server" ID="idAuthor">by <%# XPath("author") %></asp:Panel>
<asp:Panel runat="server" ID="idPrice"><%# String.Format("{0Blush | :O .00}", Convert.ToDouble(XPath("price")) * 1.22) %> <%# XPath("price") %></asp:Panel>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
<div id="demo" class="collapse">
mycontrol
</div>
</ItemTemplate>
</asp:DataList>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</ContentTemplate>
</asp:UpdatePanel>
<asp:XmlDataSource ID="idBookData" runat="server" DataFile="books.xml"></asp:XmlDataSource>
</div>
</form>
</body>
</html>




and now problem is whenever i want to hide demo(div) then nothing happen because of ID . i want to hide/show div which i select and which not can u some help me for that
Posted
Updated 26-Oct-15 21:05pm
v3
Comments
Mohammad Nawaz 27-Oct-15 1:54am    
is there no one to help me out ?
Suvendu Shekhar Giri 27-Oct-15 3:06am    
Share the faulty code.
Mohammad Nawaz 27-Oct-15 3:07am    
what should i do for that
Mohammad Nawaz 27-Oct-15 3:09am    
any idea about that how can i do ?
F-ES Sitecore 27-Oct-15 6:07am    
asp.net alters the ids to ensure they are unique. When dealing with .net controls like this don't use IDs in your javascript, instead use data attributes, or (if you must) css classes to attach to the elements. You can also add in-line click event etc attributes that can call show\hide functions and pass "this" as a parameter so that the code acts on that element.

You haven't really provided enough information or relevant code to fully understand the problem.

 
Share this answer
 
How do you say this is happen because of repeater control?

I don't think so, May be because of some other issue this may happen!

I request you to design new page with same div and same panel and skip the repeater and put some static data into that and then check, if the same issue is reproduced then only we can say that is because of repeater. First do it with static data, then let us know..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900