Click here to Skip to main content
15,910,123 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 problm 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 . wht should i do ?



XML
<%@ 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 8:25am
v2
Comments
Kornfeld Eliyahu Peter 26-Oct-15 8:50am    
Understanding ASP.NET templates: Understanding ASP NET Templates
Mohammad Nawaz 26-Oct-15 13:54pm    
give me some tips sir
Sinisa Hajnal 28-Oct-15 3:55am    
There is an event DataRowBound or RepeaterItemBound or some such in which you can bind handlers on your buttons and set IDs to names you like (like bnt_(your primary key).

Also, he gave you a tip, read the link KE Peter provided.

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