Gridview的访问元素 [英] Access element of Gridview
本文介绍了Gridview的访问元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我创建了一个gridview,在其中添加了"div"部分,并在其下创建了一个列表框.现在,我想在RowDataBound事件中为Listview分配数据源.但是我无法访问列表框.建议我如何实现这一目标.这是我的代码.
Hi all,
I''ve created a gridview in which I have added a ''div'' section and under that I''ve created a Listbox. Now I want to assign the datasource for the Listview in RowDataBound event. But I''m unable to access the Listbox. Suggest me how can I achieve this. Here is my code.
<pre lang="c#">
asp:GridView ID="gridview1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" Width="252px" onrowdatabound="gridview1_RowDataBound">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table><tr><td valign="middle" align="left">
</td></tr></table>
<asp:Button ID="btn1" Text="Show" runat="server" PostBackUrl="#" onmouseover="<%# GetPopupScript() %>" />
<div id="<%#Eval("issueid")%>DivDetails3" style="Z-INDEX:260; POSITION: absolute;HEIGHT:38px; display:none">
<table bgcolor="#cccccc" border="1" bordercolor="#ff9900" cellpadding="1" cellspacing="0"
style="border-collapse: collapse; width: 201px; height: 1px;">
<tr>
<td colspan="1" style="height: 115px">
<table bordercolor="#ffff00" cellpadding="1" cellspacing="0" style="width: 229px">
<tr>
<td align="left" colspan="2" style="width: 77%; height: 14px;">
SendMail
</td>
<td align="right" style="height: 14px; width: 23%;">
<a href="#" önclick="CloseDiv3(''DivDetails3'');" title="Click here to close.">
X</a>
</td>
</tr>
<tr colspan="2">
<td align="left" valign="middle">
<asp:ListBox ID="lstEmailIds" runat="server" SelectionMode="Multiple" Width="223px">
</asp:ListBox>
</td>
</tr>
<tr colspan="2">
<td>
<asp:TextBox runat="server" ID="txtNotifyComments" Height="47px" TextMode="MultiLine"
Width="222px"></asp:TextBox>
</td>
</tr>
<tr colspan="2">
<td>
<asp:Button ID="btnSendMail" runat="server" Text="Send Mail" CssClass="standardText"
AccessKey="M" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
推荐答案
使用page.findcontrol方法即可解决.
It''s solved by using page.findcontrol method.
这篇关于Gridview的访问元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文