我在page_load里面获取的,但是获取的都为Null,请问怎么获取到我前台是这样写的 <asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:Panel ID="plURL" runat="server">
<iframe width="1020px" id="IFURL" height="900px" frameborder="0" scrolling="no" src='<%#Eval("s_URL") %>'></iframe>
</asp:Panel>
<asp:Panel ID="plImage" runat="server" Visible="false">
<asp:Image ID="imgPic" width="1020px" height="700px" ImageUrl='<%#Eval("S_picture") %>' runat="server" />
</asp:Panel>
<p></p>
<a style="font-size:14px;">说明:<%#Eval("S_instruction") %></a>
</ItemTemplate>
</asp:Repeater>
现在我就想获取到panle,就是plurl和plImage
<ItemTemplate>
<asp:Panel ID="plURL" runat="server">
<iframe width="1020px" id="IFURL" height="900px" frameborder="0" scrolling="no" src='<%#Eval("s_URL") %>'></iframe>
</asp:Panel>
<asp:Panel ID="plImage" runat="server" Visible="false">
<asp:Image ID="imgPic" width="1020px" height="700px" ImageUrl='<%#Eval("S_picture") %>' runat="server" />
</asp:Panel>
<p></p>
<a style="font-size:14px;">说明:<%#Eval("S_instruction") %></a>
</ItemTemplate>
</asp:Repeater>
现在我就想获取到panle,就是plurl和plImage
解决方案 »
- PetShop和BeerHouse关于BLL层的问题?
- 怎么给 dropdownlist 赋值
- 使用自定义身份验证数据库在IIS下验证失效的问题
- DataKey key = GridView1.DataKeys[index]; 索引超出范围。必须为非负
- 怎样控制ImageButton的onclick?
- 存储图片的过程 急啊
- JS实现广告图片滚动效果
- 用户控件:初次使用用户控件,请教一个问题。兄弟姐妹们,出手了!
- 50分求添加新记录不成功的原因!
- 学了不少,.NET关于XML的知识,对语法和一系列的知识都了解不少了,现在苦于普通的.NET项目或者哪些方面用XML比较好。
- 如何让BulletedList的ListItem中,包含html代码
- 大家好来看个鼠标移上去style。
Repeater1_ItemDataBound 事件Panel p = (Panel)e.Item.FindControl("Panel控件的ID");
<asp:Repeater ID="repeater1" runat="server">
<ItemTemplate>
<asp:Panel ID="plURL" runat="server">
<iframe width="1020px" id="IFURL" height="900px" frameborder="0" scrolling="no" src='<%#Eval("s_URL") %>'></iframe>
</asp:Panel>
<asp:HiddenField ID="hidden1" runat="server" Value='<%#Eval("s_URL") %>' />
<asp:Panel ID="plImage" runat="server" Visible="false">
<asp:Image ID="imgPic" width="1020px" height="700px" ImageUrl='<%#Eval("S_picture") %>' runat="server" />
</asp:Panel>
<p></p>
<a style="font-size:14px;">说明:<%#Eval("S_instruction") %></a>
</ItemTemplate>
</asp:Repeater>
代码:
for (int i = 0; i < repeater1.Items.Count; i++)
{
HiddenField hf1 = repeater1.Items[i].FindControl("hidden1") as HiddenField;
获取另一个同上。。
}
Repeater1.DataSource = dt;
Repeater1.DataBind();
在绑定之后才能取,rowIndex是行号~
Panel plURL=(Panel)Repeater1.Controls[rowIndex].FindControl("plURL");