repetear在控件内生成id [英] repetear generate id inside control

查看:124
本文介绍了repetear在控件内生成id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用转发器控件,但问题是我显示了数据库中的一些数据和面板中的一些div字段,但我面临的问题是我的数据很好但我的div重复这也很好但我的问题是在div我有按钮,然后点击我的面板按钮是隐藏的,但是由于我的面板id.it在这里不起作用,因此会增加panel_1,pnel_2。我该怎么办?



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 ?

<%@ 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>









现在问题是每当我想隐藏demo(div)然后没有因为ID而发生。我想隐藏/显示我选择的div,哪些不能帮助我





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

推荐答案

关于我的面向转发器控制问题 [ ^ ]


怎么说是因为转发器控制而发生的?



我不这么认为,可能是因为其他一些问题可能会发生这种情况!



我请求你设计具有相同div和相同面板的新页面并跳过转发器并将一些静态数据放入其中然后检查,如果再现同样的问题那么只有我们可以说这是因为中继器。首先使用静态数据,然后告诉我们..
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..


这篇关于repetear在控件内生成id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆