单步执行控件看不到第二个下拉列表
我有一个 ASP.net 表。 在几个单元格中,我有两个下拉列表。 每个下拉列表中选择的项目应该从 SQLServer 2005 数据库填充。 为了在后面的代码中执行此操作,我将逐步执行每个表格单元格中的控件。 该代码会看到第一个下拉列表并填充它,然后转到下一个单元格。
我的 ASP
<asp:TableRow runat="server" ID="rowEnglish">
<asp:TableCell ID="celCourseEnglish" runat="server">
<asp:DropDownList ID="ddlCourseEnglish" runat="server" AutoPostBack="True">
<asp:ListItem Value="0">English</asp:ListItem>
</asp:DropDownList>
<br />
<asp:DropDownList ID="ddlCommentEnglish" runat="server" Font-Size="X-Small" DataSourceID="sqlDS_comment" DataTextField="comment" DataValueField="id" Width="125px">
</asp:DropDownList>
我的 VB
For Each rowTemp In dtScores.Rows
Dim tblRow As TableRow
For Each tblRow In tblProgReport.Rows
Dim celTemp As New TableCell
For Each celTemp In tblRow.Cells
Dim ctl As Control
For Each ctl In celTemp.Controls
If TypeOf ctl Is DropDownList Then
Dim ddlTemp As DropDownList = CType(ctl, DropDownList)
'select value from dropdown list
我尝试更改单元格中控件的顺序,但课程下拉列表仍然是所看到的。 尝试删除课程下拉列表,然后评论下拉列表正确显示。 整个内容都在母版页的内容占位符中。 不知道为什么看不到第二个下拉列表。
谢谢
I have an ASP.net table. In several cells I have two dropdown lists. The item selected in each dropdownlist is supposed to be populated from an SQLServer 2005 database. To do this in my code behind I step through the controls in each table cell. The code sees the first dropdown and populates it and then goes to the next cell.
My ASP
<asp:TableRow runat="server" ID="rowEnglish">
<asp:TableCell ID="celCourseEnglish" runat="server">
<asp:DropDownList ID="ddlCourseEnglish" runat="server" AutoPostBack="True">
<asp:ListItem Value="0">English</asp:ListItem>
</asp:DropDownList>
<br />
<asp:DropDownList ID="ddlCommentEnglish" runat="server" Font-Size="X-Small" DataSourceID="sqlDS_comment" DataTextField="comment" DataValueField="id" Width="125px">
</asp:DropDownList>
my VB
For Each rowTemp In dtScores.Rows
Dim tblRow As TableRow
For Each tblRow In tblProgReport.Rows
Dim celTemp As New TableCell
For Each celTemp In tblRow.Cells
Dim ctl As Control
For Each ctl In celTemp.Controls
If TypeOf ctl Is DropDownList Then
Dim ddlTemp As DropDownList = CType(ctl, DropDownList)
'select value from dropdown list
I've tried changing the order of the controls in the cell, with the course dropdown still being the one seen. Tried removing the course dropdown and then the comment dropdown displays correctly. The whole thing is in a content placeholder from a master page. Not sure why the second dropdown is not being seen.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要发布完整的 VB 代码。 找到后你在做什么? 你继续你的 foreach 正确吗? 你不挣脱出来吗?
You may have to post your complete VB code. What are you doing once you find it? You are continuing in your foreach correct? You are not breaking out of it?